Skip to content

Commit c0c3e74

Browse files
authored
Merge pull request #1047 from Vekhir/make-createDocumentProxyStructure-static
refactor(UBPersistenceManager): Make createDocumentProxyStructure static
2 parents 358b7b6 + 7f7e955 commit c0c3e74

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/core/UBPersistenceManager.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,7 @@ void UBPersistenceManager::createDocumentProxiesStructure(const QFileInfoList &c
178178
QObject::connect(&futureWatcher, &QFutureWatcher<void>::progressValueChanged, &mProgress, &QProgressDialog::setValue);
179179

180180
// Start the computation.
181-
std::function<std::shared_ptr<UBDocumentProxy> (QFileInfo contentInfo)> createDocumentProxyLambda = [=](QFileInfo contentInfo) {
182-
return createDocumentProxyStructure(contentInfo);
183-
};
184-
185-
QFuture<std::shared_ptr<UBDocumentProxy>> proxiesFuture = QtConcurrent::mapped(contentInfoList, createDocumentProxyLambda);
181+
QFuture<std::shared_ptr<UBDocumentProxy>> proxiesFuture = QtConcurrent::mapped(contentInfoList, &UBPersistenceManager::createDocumentProxyStructure);
186182
futureWatcher.setFuture(proxiesFuture);
187183

188184
// Display the dialog and start the event loop.
@@ -258,7 +254,7 @@ void UBPersistenceManager::createDocumentProxiesStructure(bool interactive)
258254
}
259255
}
260256

261-
std::shared_ptr<UBDocumentProxy> UBPersistenceManager::createDocumentProxyStructure(QFileInfo& contentInfo)
257+
std::shared_ptr<UBDocumentProxy> UBPersistenceManager::createDocumentProxyStructure(const QFileInfo& contentInfo)
262258
{
263259
QString fullPath = contentInfo.absoluteFilePath();
264260

src/core/UBPersistenceManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class UBPersistenceManager : public QObject
133133

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

139139
QStringList documentSubDirectories()
@@ -167,7 +167,7 @@ class UBPersistenceManager : public QObject
167167
void documentSceneDeleted(std::shared_ptr<UBDocumentProxy> pDocumentProxy, int pIndex);
168168

169169
private:
170-
int sceneCount(const std::shared_ptr<UBDocumentProxy> pDocumentProxy);
170+
static int sceneCount(const std::shared_ptr<UBDocumentProxy> pDocumentProxy);
171171
static QStringList getSceneFileNames(const QString& folder);
172172
void renamePage(std::shared_ptr<UBDocumentProxy> pDocumentProxy,
173173
const int sourceIndex, const int targetIndex);

0 commit comments

Comments
 (0)