libquentier  0.5.0
The library for rich desktop clients of Evernote service
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/synchronization/ISyncChunksDataCounters.h>
24 #include <quentier/types/Account.h>
25 #include <quentier/types/ErrorString.h>
26 #include <quentier/types/LinkedNotebook.h>
27 #include <quentier/utility/ForwardDeclarations.h>
28 #include <quentier/utility/Linkage.h>
29 
30 #include <QObject>
31 
32 namespace quentier {
33 
34 QT_FORWARD_DECLARE_CLASS(LocalStorageManagerAsync)
35 QT_FORWARD_DECLARE_CLASS(SynchronizationManagerPrivate)
36 
37 
43 class QUENTIER_EXPORT SynchronizationManager : public QObject
44 {
45  Q_OBJECT
46 public:
83  QString host, LocalStorageManagerAsync & localStorageManagerAsync,
84  IAuthenticationManager & authenticationManager,
85  QObject * parent = nullptr, INoteStorePtr pNoteStore = {},
86  IUserStorePtr pUserStore = {},
87  IKeychainServicePtr pKeychainService = {},
88  ISyncStateStoragePtr pSyncStateStorage = {});
89 
90  virtual ~SynchronizationManager();
91 
96  bool active() const;
97 
105 
106 public Q_SLOTS:
121  void setAccount(Account account);
122 
131  void authenticate();
132 
145 
149  void synchronize();
150 
155  void stop();
156 
163  void revokeAuthentication(const qevercloud::UserID userId);
164 
176  void setDownloadNoteThumbnails(bool flag);
177 
186  void setDownloadInkNoteImages(bool flag);
187 
205  void setInkNoteImagesStoragePath(QString path);
206 
207 Q_SIGNALS:
213  void started();
214 
220  void stopped();
221 
228  void failed(ErrorString errorDescription);
229 
250  void finished(
251  Account account, bool somethingDownloaded, bool somethingSent);
252 
265  bool success, ErrorString errorDescription, qevercloud::UserID userId);
266 
281  bool success, ErrorString errorDescription, Account account);
282 
288 
294 
306 
319 
329  void rateLimitExceeded(qint32 secondsToWait);
330 
344  void remoteToLocalSyncDone(bool somethingDownloaded);
345 
362  qint32 highestDownloadedUsn, qint32 highestServerUsn,
363  qint32 lastPreviousUsn);
364 
370 
375  void syncChunksDataProcessingProgress(ISyncChunksDataCountersPtr counters);
376 
401  qint32 highestDownloadedUsn, qint32 highestServerUsn,
402  qint32 lastPreviousUsn, LinkedNotebook linkedNotebook);
403 
409 
415  ISyncChunksDataCountersPtr counters);
416 
426  quint32 notesDownloaded, quint32 totalNotesToDownload);
427 
437  quint32 notesDownloaded, quint32 totalNotesToDownload);
438 
450  quint32 resourcesDownloaded, quint32 totalResourcesToDownload);
451 
463  quint32 resourcesDownloaded, quint32 totalResourcesToDownload);
464 
471 
478 
484  void setAccountDone(Account account);
485 
491 
497 
503 
504 private:
505  SynchronizationManager() = delete;
506  Q_DISABLE_COPY(SynchronizationManager)
507 
508  SynchronizationManagerPrivate * d_ptr;
509  Q_DECLARE_PRIVATE(SynchronizationManager)
510 };
511 
512 } // namespace quentier
513 
514 #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:44
void notesDownloadProgress(quint32 notesDownloaded, quint32 totalNotesToDownload)
void syncChunksDataProcessingProgress(ISyncChunksDataCountersPtr counters)
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 linkedNotebookSyncChunksDataProcessingProgress(ISyncChunksDataCountersPtr counters)
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)