libquentier 0.5.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
SynchronizationManager.h
1/*
2 * Copyright 2016-2020 Dmitry Ivanov
3 *
4 * This file is part of libquentier
5 *
6 * libquentier is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
9 *
10 * libquentier is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LIB_QUENTIER_SYNCHRONIZATION_SYNCHRONIZATION_MANAGER_H
20#define LIB_QUENTIER_SYNCHRONIZATION_SYNCHRONIZATION_MANAGER_H
21
22#include <quentier/synchronization/ForwardDeclarations.h>
23#include <quentier/types/Account.h>
24#include <quentier/types/ErrorString.h>
25#include <quentier/types/LinkedNotebook.h>
26#include <quentier/utility/ForwardDeclarations.h>
27#include <quentier/utility/Linkage.h>
28
29#include <QObject>
30
31namespace quentier {
32
33QT_FORWARD_DECLARE_CLASS(LocalStorageManagerAsync)
34QT_FORWARD_DECLARE_CLASS(SynchronizationManagerPrivate)
35
36
42class QUENTIER_EXPORT SynchronizationManager : public QObject
43{
44 Q_OBJECT
45public:
82 QString host, LocalStorageManagerAsync & localStorageManagerAsync,
83 IAuthenticationManager & authenticationManager,
84 QObject * parent = nullptr, INoteStorePtr pNoteStore = {},
85 IUserStorePtr pUserStore = {},
86 IKeychainServicePtr pKeychainService = {},
87 ISyncStateStoragePtr pSyncStateStorage = {});
88
89 virtual ~SynchronizationManager();
90
95 bool active() const;
96
104
105public Q_SLOTS:
120 void setAccount(Account account);
121
131
144
149
154 void stop();
155
162 void revokeAuthentication(const qevercloud::UserID userId);
163
176
186
204 void setInkNoteImagesStoragePath(QString path);
205
206Q_SIGNALS:
212 void started();
213
219 void stopped();
220
227 void failed(ErrorString errorDescription);
228
250 Account account, bool somethingDownloaded, bool somethingSent);
251
264 bool success, ErrorString errorDescription, qevercloud::UserID userId);
265
280 bool success, ErrorString errorDescription, Account account);
281
287
293
305
318
328 void rateLimitExceeded(qint32 secondsToWait);
329
343 void remoteToLocalSyncDone(bool somethingDownloaded);
344
361 qint32 highestDownloadedUsn, qint32 highestServerUsn,
362 qint32 lastPreviousUsn);
363
369
394 qint32 highestDownloadedUsn, qint32 highestServerUsn,
395 qint32 lastPreviousUsn, LinkedNotebook linkedNotebook);
396
402
412 quint32 notesDownloaded, quint32 totalNotesToDownload);
413
423 quint32 notesDownloaded, quint32 totalNotesToDownload);
424
436 quint32 resourcesDownloaded, quint32 totalResourcesToDownload);
437
449 quint32 resourcesDownloaded, quint32 totalResourcesToDownload);
450
457
464
470 void setAccountDone(Account account);
471
477
483
489
490private:
491 SynchronizationManager() = delete;
492 Q_DISABLE_COPY(SynchronizationManager)
493
494 SynchronizationManagerPrivate * d_ptr;
495 Q_DECLARE_PRIVATE(SynchronizationManager)
496};
497
498} // namespace quentier
499
500#endif // LIB_QUENTIER_SYNCHRONIZATION_SYNCHRONIZATION_MANAGER_H
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition Account.h:39
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition ErrorString.h:44
Definition IAuthenticationManager.h:37
Definition LinkedNotebook.h:33
Definition LocalStorageManagerAsync.h:44
The SynchronizationManager class encapsulates methods and signals & slots required to perform the ful...
Definition SynchronizationManager.h:43
void notesDownloadProgress(quint32 notesDownloaded, quint32 totalNotesToDownload)
void linkedNotebooksResourcesDownloadProgress(quint32 resourcesDownloaded, quint32 totalResourcesToDownload)
void setInkNoteImagesStoragePath(QString path)
void rateLimitExceeded(qint32 secondsToWait)
void syncChunksDownloadProgress(qint32 highestDownloadedUsn, qint32 highestServerUsn, qint32 lastPreviousUsn)
void authenticationFinished(bool success, ErrorString errorDescription, Account account)
SynchronizationManager(QString host, LocalStorageManagerAsync &localStorageManagerAsync, IAuthenticationManager &authenticationManager, QObject *parent=nullptr, INoteStorePtr pNoteStore={}, IUserStorePtr pUserStore={}, IKeychainServicePtr pKeychainService={}, ISyncStateStoragePtr pSyncStateStorage={})
void remoteToLocalSyncDone(bool somethingDownloaded)
void linkedNotebooksNotesDownloadProgress(quint32 notesDownloaded, quint32 totalNotesToDownload)
void revokeAuthentication(const qevercloud::UserID userId)
void setDownloadInkNoteImages(bool flag)
void setDownloadNoteThumbnailsDone(bool flag)
void setInkNoteImagesStoragePathDone(QString path)
void finished(Account account, bool somethingDownloaded, bool somethingSent)
void setDownloadNoteThumbnails(bool flag)
void failed(ErrorString errorDescription)
void setDownloadInkNoteImagesDone(bool flag)
void setAccount(Account account)
void authenticationRevoked(bool success, ErrorString errorDescription, qevercloud::UserID userId)
void setAccountDone(Account account)
void linkedNotebookSyncChunksDownloadProgress(qint32 highestDownloadedUsn, qint32 highestServerUsn, qint32 lastPreviousUsn, LinkedNotebook linkedNotebook)
void resourcesDownloadProgress(quint32 resourcesDownloaded, quint32 totalResourcesToDownload)