digiKam
Loading...
Searching...
No Matches
collectionmanager.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2007-04-09
7 * Description : Collection location management
8 *
9 * SPDX-FileCopyrightText: 2007-2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15#pragma once
16
17// Qt includes
18
19#include <QString>
20#include <QStringList>
21#include <QUrl>
22#include <QObject>
23
24// Local includes
25
26#include "digikam_export.h"
27
28namespace Digikam
29{
30
31class CollectionLocation;
32class AlbumRootChangeset;
33
34class DIGIKAM_DATABASE_EXPORT CollectionManager : public QObject
35{
36 Q_OBJECT
37
38public:
39
54
55public:
56
57 static CollectionManager* instance();
58 static void cleanUp();
59
65 void setWatchDisabled();
66
71 void refresh();
72
73private Q_SLOTS:
74
75 void deviceAdded(const QString&);
76 void deviceRemoved(const QString&);
77 void accessibilityChanged(bool, const QString&);
78
79private:
80
81 // Disabled
83 explicit CollectionManager(QObject*) = delete;
84 ~CollectionManager() override;
85
86 void clearLocations();
87
88 Q_PRIVATE_SLOT(d, void slotTriggerUpdateVolumesList())
89
90Q_SIGNALS: // internal use only with slotTriggerUpdateVolumesList()
91
92 void triggerUpdateVolumesList();
93
94 // -----------------------------------------------------------------------------
95
100
101public:
102
116 CollectionLocation addLocation(const QUrl& fileUrl,
117 const QString& label = QString());
118 CollectionLocation addNetworkLocation(const QUrl& fileUrl,
119 const QString& label = QString());
120 CollectionLocation refreshLocation(const CollectionLocation& location, int newType,
121 const QStringList& pathList,
122 const QString& label = QString());
123
130 LocationCheckResult checkLocation(const QUrl& fileUrl, QList<CollectionLocation>& assumeDeleted,
131 QString* message = nullptr, QString* suggestedMessageIconName = nullptr);
132 LocationCheckResult checkNetworkLocation(const QUrl& fileUrl, QList<CollectionLocation>& assumeDeleted,
133 QString* message = nullptr, QString* suggestedMessageIconName = nullptr);
134
139 void removeLocation(const CollectionLocation& location);
140
144 void setLabel(const CollectionLocation& location, const QString& label);
145
149 void changeType(const CollectionLocation& location, int type);
150
161 QList<CollectionLocation> checkHardWiredLocations();
162
169 void migrationCandidates(const CollectionLocation& disappearedLocation,
170 QString* const technicalDescription,
171 QStringList* const candidateIdentifiers,
172 QStringList* const candidateDescriptions);
173
180 void migrateToVolume(const CollectionLocation& location, const QString& identifier);
181
185 QList<CollectionLocation> allLocations();
186
190 QList<CollectionLocation> allAvailableLocations();
191
195 CollectionLocation locationForAlbumRootId(int id);
196
203 CollectionLocation locationForAlbumRoot(const QUrl& fileUrl);
204 CollectionLocation locationForAlbumRootPath(const QString& albumRootPath);
205
211 CollectionLocation locationForUrl(const QUrl& fileUrl);
212 CollectionLocation locationForPath(const QString& filePath);
213
214private:
215
216 void updateLocations();
217
218Q_SIGNALS:
219
234 void locationStatusChanged(const CollectionLocation& location, int oldStatus);
235
239 void locationPropertiesChanged(const CollectionLocation& location);
240
242
243 // -----------------------------------------------------------------------------
244
249
250public:
251
255 QStringList allAvailableAlbumRootPaths();
256
261 QString albumRootPath(int id);
262
267 QString albumRootLabel(int id);
268
270
275 QUrl albumRoot(const QUrl& fileUrl);
276 QString albumRootPath(const QUrl& fileUrl);
277 QString albumRootPath(const QString& filePath);
279
288 bool isAlbumRoot(const QUrl& fileUrl);
289
293 bool isAlbumRoot(const QString& filePath);
294
296
307 QString album(const QUrl& fileUrl);
308 QString album(const QString& filePath);
309 QString album(const CollectionLocation& location, const QUrl& fileUrl);
310 QString album(const CollectionLocation& location, const QString& filePath);
312
314
319 QUrl oneAlbumRoot();
320 QString oneAlbumRootPath();
322
323private Q_SLOTS:
324
325 void slotAlbumRootChange(const AlbumRootChangeset& changeset);
326
328
329public:
330
331 class Private;
332
333private:
334
335 static CollectionManager* m_instance;
336
337 Private* const d = nullptr;
338
339 friend class Private;
340 friend class CoreDbWatch;
341 friend class CoreDbAccess;
342};
343
344} // namespace Digikam
Definition coredbchangesets.h:327
Definition collectionlocation.h:31
Definition collectionmanager_p.h:204
Definition collectionmanager.h:35
LocationCheckResult
Definition collectionmanager.h:41
@ LocationHasProblems
Location can be added, but the user should be aware of a problem.
Definition collectionmanager.h:49
@ LocationAllRight
All right. The accompanying message may be empty.
Definition collectionmanager.h:46
@ LocationInvalidCheck
The check did not succeed, status unknown.
Definition collectionmanager.h:43
Definition coredbaccess.h:46
Definition coredbwatch.h:34
Definition datefolderview.cpp:34