Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(UBPersistenceManager): Make createDocumentProxyStructure static #1047

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/core/UBPersistenceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,7 @@ void UBPersistenceManager::createDocumentProxiesStructure(const QFileInfoList &c
QObject::connect(&futureWatcher, &QFutureWatcher<void>::progressValueChanged, &mProgress, &QProgressDialog::setValue);

// Start the computation.
std::function<std::shared_ptr<UBDocumentProxy> (QFileInfo contentInfo)> createDocumentProxyLambda = [=](QFileInfo contentInfo) {
return createDocumentProxyStructure(contentInfo);
};

QFuture<std::shared_ptr<UBDocumentProxy>> proxiesFuture = QtConcurrent::mapped(contentInfoList, createDocumentProxyLambda);
QFuture<std::shared_ptr<UBDocumentProxy>> proxiesFuture = QtConcurrent::mapped(contentInfoList, &UBPersistenceManager::createDocumentProxyStructure);
futureWatcher.setFuture(proxiesFuture);

// Display the dialog and start the event loop.
Expand Down Expand Up @@ -269,7 +265,7 @@ void UBPersistenceManager::createDocumentProxiesStructure(bool interactive)
}
}

std::shared_ptr<UBDocumentProxy> UBPersistenceManager::createDocumentProxyStructure(QFileInfo& contentInfo)
std::shared_ptr<UBDocumentProxy> UBPersistenceManager::createDocumentProxyStructure(const QFileInfo& contentInfo)
{
QString fullPath = contentInfo.absoluteFilePath();
QDir dir(fullPath);
Expand Down
4 changes: 2 additions & 2 deletions src/core/UBPersistenceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class UBPersistenceManager : public QObject

void createDocumentProxiesStructure(bool interactive = false);
void createDocumentProxiesStructure(const QFileInfoList &contentInfoList, bool interactive = false);
std::shared_ptr<UBDocumentProxy> createDocumentProxyStructure(QFileInfo &contentInfo);
static std::shared_ptr<UBDocumentProxy> createDocumentProxyStructure(const QFileInfo &contentInfo);
QDialog::DialogCode processInteractiveReplacementDialog(std::shared_ptr<UBDocumentProxy> pProxy, bool multipleFiles = false);

QStringList documentSubDirectories()
Expand Down Expand Up @@ -164,7 +164,7 @@ class UBPersistenceManager : public QObject
void documentSceneCreated(std::shared_ptr<UBDocumentProxy> pDocumentProxy, int pIndex);

private:
int sceneCount(const std::shared_ptr<UBDocumentProxy> pDocumentProxy);
static int sceneCount(const std::shared_ptr<UBDocumentProxy> pDocumentProxy);
static QStringList getSceneFileNames(const QString& folder);
void renamePage(std::shared_ptr<UBDocumentProxy> pDocumentProxy,
const int sourceIndex, const int targetIndex);
Expand Down