preferencesAboutTextFull
Clément Fauconnier 3 years ago
commit 5c71d4b3c9
  1. 1
      OpenBoard.pro
  2. 1
      release_scripts/linux/package.sh
  3. 1
      src/core/UBApplicationController.cpp
  4. 2
      src/core/UBDisplayManager.cpp
  5. 2
      src/core/UBDocumentManager.cpp
  6. 81
      src/core/UBPersistenceManager.cpp
  7. 5
      src/core/UBPersistenceManager.h
  8. 2
      src/desktop/UBCustomCaptureWindow.cpp
  9. 9
      src/desktop/UBDesktopAnnotationController.cpp
  10. 16
      src/document/UBDocumentController.cpp
  11. 7
      src/frameworks/UBFileSystemUtils.cpp
  12. 4
      src/gui/UBBoardThumbnailsView.cpp

@ -40,6 +40,7 @@ QT += webkitwidgets
QT += multimediawidgets QT += multimediawidgets
QT += printsupport QT += printsupport
QT += core QT += core
QT += concurrent
INCLUDEPATH += src INCLUDEPATH += src

@ -215,6 +215,7 @@ if $BUNDLE_QT; then
notifyProgress "Copying and stripping Qt libraries" notifyProgress "Copying and stripping Qt libraries"
mkdir -p $QT_LIBRARY_DEST_PATH mkdir -p $QT_LIBRARY_DEST_PATH
copyQtLibrary libQt5Concurrent
copyQtLibrary libQt5Core copyQtLibrary libQt5Core
copyQtLibrary libQt5DBus copyQtLibrary libQt5DBus
copyQtLibrary libQt5Gui copyQtLibrary libQt5Gui

@ -465,6 +465,7 @@ void UBApplicationController::showDesktop(bool dontSwitchFrontProcess)
if (mMirror) if (mMirror)
{ {
QRect rect = qApp->desktop()->screenGeometry(desktopWidgetIndex); QRect rect = qApp->desktop()->screenGeometry(desktopWidgetIndex);
rect.moveTo(0, 0);
mMirror->setSourceRect(rect); mMirror->setSourceRect(rect);
} }

@ -236,7 +236,7 @@ void UBDisplayManager::positionScreens()
if (mDisplayWidget && mDisplayScreenIndex > -1) if (mDisplayWidget && mDisplayScreenIndex > -1)
{ {
mDisplayWidget->hide(); mDisplayWidget->showNormal();
mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex)); mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex));
UBPlatformUtils::showFullScreen(mDisplayWidget); UBPlatformUtils::showFullScreen(mDisplayWidget);
} }

@ -286,8 +286,6 @@ int UBDocumentManager::addFilesToDocument(UBDocumentProxy* document, QStringList
UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(document, pageIndex); UBGraphicsScene* scene = UBPersistenceManager::persistenceManager()->createDocumentSceneAt(document, pageIndex);
importAdaptor->placeImportedItemToScene(scene, page); importAdaptor->placeImportedItemToScene(scene, page);
UBPersistenceManager::persistenceManager()->persistDocumentScene(document, scene, pageIndex); UBPersistenceManager::persistenceManager()->persistDocumentScene(document, scene, pageIndex);
if (UBApplication::documentController->selectedDocument() == UBApplication::boardController->selectedDocument())
UBApplication::boardController->insertThumbPage(pageIndex);
} }
UBPersistenceManager::persistenceManager()->persistDocumentMetadata(document); UBPersistenceManager::persistenceManager()->persistDocumentMetadata(document);

@ -34,6 +34,7 @@
#include <QDomDocument> #include <QDomDocument>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
#include <QModelIndex> #include <QModelIndex>
#include <QtConcurrent>
#include "frameworks/UBPlatformUtils.h" #include "frameworks/UBPlatformUtils.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
@ -98,7 +99,6 @@ UBPersistenceManager::UBPersistenceManager(QObject *pParent)
mDocumentTreeStructureModel = new UBDocumentTreeModel(this); mDocumentTreeStructureModel = new UBDocumentTreeModel(this);
createDocumentProxiesStructure(); createDocumentProxiesStructure();
emit proxyListChanged(); emit proxyListChanged();
} }
@ -123,6 +123,50 @@ UBPersistenceManager::~UBPersistenceManager()
{ {
} }
void UBPersistenceManager::createDocumentProxiesStructure(const QFileInfoList &contentInfoList, bool interactive)
{
// Create a QFutureWatcher and connect signals and slots.
QFutureWatcher<UBDocumentProxy*> futureWatcher;
QObject::connect(&futureWatcher, &QFutureWatcher<void>::finished, &mProgress, &QProgressDialog::reset);
QObject::connect(&futureWatcher, &QFutureWatcher<void>::progressRangeChanged, &mProgress, &QProgressDialog::setRange);
QObject::connect(&futureWatcher, &QFutureWatcher<void>::progressValueChanged, &mProgress, &QProgressDialog::setValue);
// Start the computation.
std::function<UBDocumentProxy* (QFileInfo contentInfo)> createDocumentProxyLambda = [=](QFileInfo contentInfo) {
return createDocumentProxyStructure(contentInfo);
};
QFuture<UBDocumentProxy*> proxiesFuture = QtConcurrent::mapped(contentInfoList, createDocumentProxyLambda);
futureWatcher.setFuture(proxiesFuture);
// Display the dialog and start the event loop.
mProgress.exec();
futureWatcher.waitForFinished();
QList<UBDocumentProxy*> proxies = futureWatcher.future().results();
for (auto&& proxy : qAsConst(proxies))
{
if (proxy)
{
QString docGroupName = proxy->metaData(UBSettings::documentGroupName).toString();
QModelIndex parentIndex = mDocumentTreeStructureModel->goTo(docGroupName);
if (parentIndex.isValid())
{
if (!interactive)
mDocumentTreeStructureModel->addDocument(proxy, parentIndex);
else
processInteractiveReplacementDialog(proxy);
}
else
{
qDebug() << "something went wrong";
}
}
}
}
void UBPersistenceManager::createDocumentProxiesStructure(bool interactive) void UBPersistenceManager::createDocumentProxiesStructure(bool interactive)
{ {
mDocumentRepositoryPath = UBSettings::userDocumentDirectory(); mDocumentRepositoryPath = UBSettings::userDocumentDirectory();
@ -130,8 +174,13 @@ void UBPersistenceManager::createDocumentProxiesStructure(bool interactive)
QDir rootDir(mDocumentRepositoryPath); QDir rootDir(mDocumentRepositoryPath);
rootDir.mkpath(rootDir.path()); rootDir.mkpath(rootDir.path());
QFileInfoList contentList = rootDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time | QDir::Reversed); QFileInfoList contentInfoList = rootDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Time | QDir::Reversed);
createDocumentProxiesStructure(contentList, interactive);
mProgress.setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
mProgress.setLabelText(QString("retrieving all your documents (found %1)").arg(contentInfoList.size()));
mProgress.setCancelButton(nullptr);
createDocumentProxiesStructure(contentInfoList, interactive);
if (QFileInfo(mFoldersXmlStorageName).exists()) { if (QFileInfo(mFoldersXmlStorageName).exists()) {
QDomDocument xmlDom; QDomDocument xmlDom;
@ -158,12 +207,9 @@ void UBPersistenceManager::createDocumentProxiesStructure(bool interactive)
} }
} }
void UBPersistenceManager::createDocumentProxiesStructure(const QFileInfoList &contentInfo, bool interactive) UBDocumentProxy* UBPersistenceManager::createDocumentProxyStructure(QFileInfo& contentInfo)
{ {
foreach(QFileInfo path, contentInfo) QString fullPath = contentInfo.absoluteFilePath();
{
QString fullPath = path.absoluteFilePath();
QDir dir(fullPath); QDir dir(fullPath);
if (dir.entryList(QDir::Files | QDir::NoDotAndDotDot).size() > 0) if (dir.entryList(QDir::Files | QDir::NoDotAndDotDot).size() > 0)
@ -174,12 +220,7 @@ void UBPersistenceManager::createDocumentProxiesStructure(const QFileInfoList &c
if (docName.isEmpty()) { if (docName.isEmpty()) {
qDebug() << "Group name and document name are empty in UBPersistenceManager::createDocumentProxiesStructure()"; qDebug() << "Group name and document name are empty in UBPersistenceManager::createDocumentProxiesStructure()";
continue; return nullptr;
}
QModelIndex parentIndex = mDocumentTreeStructureModel->goTo(docGroupName);
if (!parentIndex.isValid()) {
return;
} }
UBDocumentProxy* docProxy = new UBDocumentProxy(fullPath); // managed in UBDocumentTreeNode UBDocumentProxy* docProxy = new UBDocumentProxy(fullPath); // managed in UBDocumentTreeNode
@ -189,14 +230,14 @@ void UBPersistenceManager::createDocumentProxiesStructure(const QFileInfoList &c
docProxy->setPageCount(sceneCount(docProxy)); docProxy->setPageCount(sceneCount(docProxy));
if (!interactive) docProxy->moveToThread(UBApplication::instance()->thread());
mDocumentTreeStructureModel->addDocument(docProxy, parentIndex);
else return docProxy;
processInteractiveReplacementDialog(docProxy);
}
}
} }
return nullptr;
};
QDialog::DialogCode UBPersistenceManager::processInteractiveReplacementDialog(UBDocumentProxy *pProxy) QDialog::DialogCode UBPersistenceManager::processInteractiveReplacementDialog(UBDocumentProxy *pProxy)
{ {
//TODO claudio remove this hack necessary on double click on ubz file //TODO claudio remove this hack necessary on double click on ubz file

@ -131,7 +131,8 @@ class UBPersistenceManager : public QObject
bool addDirectoryContentToDocument(const QString& documentRootFolder, UBDocumentProxy* pDocument); bool addDirectoryContentToDocument(const QString& documentRootFolder, UBDocumentProxy* pDocument);
void createDocumentProxiesStructure(bool interactive = false); void createDocumentProxiesStructure(bool interactive = false);
void createDocumentProxiesStructure(const QFileInfoList &contentInfo, bool interactive = false); void createDocumentProxiesStructure(const QFileInfoList &contentInfoList, bool interactive = false);
UBDocumentProxy* createDocumentProxyStructure(QFileInfo &contentInfo);
QDialog::DialogCode processInteractiveReplacementDialog(UBDocumentProxy *pProxy); QDialog::DialogCode processInteractiveReplacementDialog(UBDocumentProxy *pProxy);
QStringList documentSubDirectories() QStringList documentSubDirectories()
@ -187,6 +188,8 @@ private:
bool mHasPurgedDocuments; bool mHasPurgedDocuments;
QString mDocumentRepositoryPath; QString mDocumentRepositoryPath;
QString mFoldersXmlStorageName; QString mFoldersXmlStorageName;
QProgressDialog mProgress;
QFutureWatcher<void> futureWatcher;
private slots: private slots:
void documentRepositoryChanged(const QString& path); void documentRepositoryChanged(const QString& path);

@ -79,6 +79,8 @@ int UBCustomCaptureWindow::execute(const QPixmap &pScreenPixmap)
QDesktopWidget *desktop = QApplication::desktop(); QDesktopWidget *desktop = QApplication::desktop();
int currentScreen = desktop->screenNumber(QCursor::pos()); int currentScreen = desktop->screenNumber(QCursor::pos());
// necessary so that changing geometry really affects the widget
showNormal();
setGeometry(desktop->screenGeometry(currentScreen)); setGeometry(desktop->screenGeometry(currentScreen));
this->show(); this->show();
setWindowOpacity(1.0); setWindowOpacity(1.0);

@ -516,6 +516,7 @@ QPixmap UBDesktopAnnotationController::getScreenPixmap()
QScreen * screen = UBApplication::controlScreen(); QScreen * screen = UBApplication::controlScreen();
QRect rect = desktop->screenGeometry(QCursor::pos()); QRect rect = desktop->screenGeometry(QCursor::pos());
rect.moveTo(0, 0);
return screen->grabWindow(desktop->effectiveWinId(), return screen->grabWindow(desktop->effectiveWinId(),
rect.x(), rect.y(), rect.width(), rect.height()); rect.x(), rect.y(), rect.width(), rect.height());
@ -556,7 +557,7 @@ void UBDesktopAnnotationController::penActionPressed()
// Check if the mouse cursor is on the little arrow // Check if the mouse cursor is on the little arrow
QPoint cursorPos = QCursor::pos(); QPoint cursorPos = QCursor::pos();
QPoint palettePos = mDesktopPalette->pos(); QPoint palettePos = mDesktopPalette->mapToGlobal(QPoint(0, 0)); // global coordinates of palette
QPoint buttonPos = mDesktopPalette->buttonPos(UBApplication::mainWindow->actionPen); QPoint buttonPos = mDesktopPalette->buttonPos(UBApplication::mainWindow->actionPen);
int iX = cursorPos.x() - (palettePos.x() + buttonPos.x()); // x position of the cursor in the palette int iX = cursorPos.x() - (palettePos.x() + buttonPos.x()); // x position of the cursor in the palette
@ -610,7 +611,7 @@ void UBDesktopAnnotationController::eraserActionPressed()
// Check if the mouse cursor is on the little arrow // Check if the mouse cursor is on the little arrow
QPoint cursorPos = QCursor::pos(); QPoint cursorPos = QCursor::pos();
QPoint palettePos = mDesktopPalette->pos(); QPoint palettePos = mDesktopPalette->mapToGlobal(QPoint(0, 0));
QPoint buttonPos = mDesktopPalette->buttonPos(UBApplication::mainWindow->actionEraser); QPoint buttonPos = mDesktopPalette->buttonPos(UBApplication::mainWindow->actionEraser);
int iX = cursorPos.x() - (palettePos.x() + buttonPos.x()); // x position of the cursor in the palette int iX = cursorPos.x() - (palettePos.x() + buttonPos.x()); // x position of the cursor in the palette
@ -665,7 +666,7 @@ void UBDesktopAnnotationController::markerActionPressed()
// Check if the mouse cursor is on the little arrow // Check if the mouse cursor is on the little arrow
QPoint cursorPos = QCursor::pos(); QPoint cursorPos = QCursor::pos();
QPoint palettePos = mDesktopPalette->pos(); QPoint palettePos = mDesktopPalette->mapToGlobal(QPoint(0, 0));
QPoint buttonPos = mDesktopPalette->buttonPos(UBApplication::mainWindow->actionMarker); QPoint buttonPos = mDesktopPalette->buttonPos(UBApplication::mainWindow->actionMarker);
int iX = cursorPos.x() - (palettePos.x() + buttonPos.x()); // x position of the cursor in the palette int iX = cursorPos.x() - (palettePos.x() + buttonPos.x()); // x position of the cursor in the palette
@ -967,7 +968,7 @@ void UBDesktopAnnotationController::updateMask(bool bTransparent)
p.setPen(Qt::red); p.setPen(Qt::red);
p.setBrush(QBrush(Qt::red)); p.setBrush(QBrush(Qt::red));
p.drawRect(mTransparentDrawingView->geometry().x(), mTransparentDrawingView->geometry().y(), mTransparentDrawingView->width(), mTransparentDrawingView->height()); p.drawRect(0, 0, mTransparentDrawingView->width(), mTransparentDrawingView->height());
p.end(); p.end();
mTransparentDrawingView->setMask(mMask.mask()); mTransparentDrawingView->setMask(mMask.mask());

@ -2393,10 +2393,13 @@ void UBDocumentController::duplicateSelectedItem()
int sceneCount = selectedSceneIndexes.count(); int sceneCount = selectedSceneIndexes.count();
showMessage(tr("duplicated %1 page","duplicated %1 pages",sceneCount).arg(sceneCount), false); showMessage(tr("duplicated %1 page","duplicated %1 pages",sceneCount).arg(sceneCount), false);
if (selectedDocument() == mBoardController->selectedDocument())
{
mBoardController->setActiveDocumentScene(selectedThumbnail); mBoardController->setActiveDocumentScene(selectedThumbnail);
mBoardController->reloadThumbnails(); mBoardController->reloadThumbnails();
} }
} }
}
else else
{ {
UBDocumentTreeModel *docModel = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel; UBDocumentTreeModel *docModel = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel;
@ -2999,6 +3002,8 @@ void UBDocumentController::addFolderOfImages()
document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(document); UBMetadataDcSubsetAdaptor::persist(document);
reloadThumbnails(); reloadThumbnails();
if (selectedDocument() == UBApplication::boardController->selectedDocument())
UBApplication::boardController->reloadThumbnails();
} }
} }
} }
@ -3012,11 +3017,6 @@ void UBDocumentController::addFileToDocument()
if (document) if (document)
{ {
addFileToDocument(document); addFileToDocument(document);
reloadThumbnails();
if (UBApplication::boardController->selectedDocument() == selectedDocument())
{
UBApplication::boardController->reloadThumbnails();
}
} }
} }
@ -3050,6 +3050,8 @@ bool UBDocumentController::addFileToDocument(UBDocumentProxy* document)
document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(document); UBMetadataDcSubsetAdaptor::persist(document);
reloadThumbnails(); reloadThumbnails();
if (selectedDocument() == UBApplication::boardController->selectedDocument())
UBApplication::boardController->reloadThumbnails();
} }
else else
{ {
@ -3328,6 +3330,8 @@ void UBDocumentController::addImages()
document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime())); document->setMetaData(UBSettings::documentUpdatedAt, UBStringUtils::toUtcIsoDateTime(QDateTime::currentDateTime()));
UBMetadataDcSubsetAdaptor::persist(document); UBMetadataDcSubsetAdaptor::persist(document);
reloadThumbnails(); reloadThumbnails();
if (selectedDocument() == UBApplication::boardController->selectedDocument())
UBApplication::boardController->reloadThumbnails();
} }
} }
} }
@ -3777,6 +3781,8 @@ void UBDocumentController:: refreshDocumentThumbnailsView(UBDocumentContainer* s
, QList<QUrl>() , QList<QUrl>()
, QStringList() , QStringList()
, UBApplication::mimeTypeUniboardPage); , UBApplication::mimeTypeUniboardPage);
QApplication::restoreOverrideCursor();
return; return;
} }

@ -105,6 +105,11 @@ bool UBFileSystemUtils::copyFile(const QString &source, const QString &destinati
if (QFileInfo(normalizedDestination).isFile() && overwrite) { if (QFileInfo(normalizedDestination).isFile() && overwrite) {
QFile::remove(normalizedDestination); QFile::remove(normalizedDestination);
} }
else
{
if (!overwrite)
return true; // don't try to copy an existing file if overwrite is false
}
} else { } else {
normalizedDestination = normalizedDestination.replace(QString("\\"), QString("/")); normalizedDestination = normalizedDestination.replace(QString("\\"), QString("/"));
int pos = normalizedDestination.lastIndexOf("/"); int pos = normalizedDestination.lastIndexOf("/");
@ -300,7 +305,7 @@ bool UBFileSystemUtils::copyDir(const QString& pSourceDirPath, const QString& pT
{ {
if (dirContent.isDir()) if (dirContent.isDir())
{ {
successSoFar = copyDir(pSourceDirPath + "/" + dirContent.fileName(), pTargetDirPath + "/" + dirContent.fileName()); successSoFar = copyDir(pSourceDirPath + "/" + dirContent.fileName(), pTargetDirPath + "/" + dirContent.fileName(), overwite);
} }
else else
{ {

@ -307,7 +307,7 @@ void UBBoardThumbnailsView::dragMoveEvent(QDragMoveEvent *event)
{ {
y = item->pos().y() - UBSettings::thumbnailSpacing / 2; y = item->pos().y() - UBSettings::thumbnailSpacing / 2;
if (mDropBar->y() != y) if (mDropBar->y() != y)
mDropBar->setRect(QRectF(item->pos().x(), y, mThumbnailWidth-verticalScrollBar()->width(), 3)); mDropBar->setRect(QRectF(item->pos().x(), y, (item->boundingRect().width()-verticalScrollBar()->width())*scale, 3));
} }
} }
else else
@ -316,7 +316,7 @@ void UBBoardThumbnailsView::dragMoveEvent(QDragMoveEvent *event)
{ {
y = item->pos().y() + item->boundingRect().height() * scale + UBSettings::thumbnailSpacing / 2; y = item->pos().y() + item->boundingRect().height() * scale + UBSettings::thumbnailSpacing / 2;
if (mDropBar->y() != y) if (mDropBar->y() != y)
mDropBar->setRect(QRectF(item->pos().x(), y, mThumbnailWidth-verticalScrollBar()->width(), 3)); mDropBar->setRect(QRectF(item->pos().x(), y, (item->boundingRect().width()-verticalScrollBar()->width())*scale, 3));
} }
} }
} }

Loading…
Cancel
Save