-
Notifications
You must be signed in to change notification settings - Fork 2
/
cache.h
74 lines (69 loc) · 2.08 KB
/
cache.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef CACHE_H
#define CACHE_H
#include "edam/UserStore.h"
#include "edam/UserStore_constants.h"
#include "edam/NoteStore.h"
#include "edam/NoteStore_constants.h"
#include "edam/NoteStore_types.h"
#include "wrappers/tagwrapper.h"
#include "wrappers/notewrapper.h"
#include "wrappers/notebookwrapper.h"
#include "wrappers/savedsearchwrapper.h"
#include "db/databaseconstants.h"
#include "db/databasemanager.h"
#include "settings.h"
#include "evernotesession.h"
#include <QtCore>
#include <QObject>
using namespace evernote::edam;
using namespace std;
class Cache : public QObject
{
Q_OBJECT
public:
static Cache* instance();
static Notebook* selectedNotebook();
Cache(QObject *parent = 0);
~Cache();
signals:
void clearNotes();
void clearSearches();
void noteAdded(NoteWrapper* note);
void tagFired(TagWrapper* tag);
void notebookFired(NotebookWrapper* notebook);
void savedSearchFired(SavedSearchWrapper* search);
public slots:
void load();
void softLoad();
void clear();
void setSelectedNotebook(QString guid);
NoteWrapper* getNote(int index);
void clearFileCache();
void fillWithTags();
void fillWithNotebooks();
void fillWithSavedSearches();
QString getNoteContent(NoteWrapper* note);
QString getCacheFileName(NoteWrapper* note);
NotebookWrapper* getNotebook(NoteWrapper* note);
NotebookWrapper* getFirstNoteBook();
NoteWrapper* getNoteForGuid(QString guid);
TagWrapper* getTagForGuid(QString guid);
QString genGuid();
ResourceWrapper* getResourceForNote(NoteWrapper* note, QString guid);
SavedSearchWrapper* getSavedSearch(int index);
SavedSearchWrapper* getSavedSearchForGuid(QString guid);
void setToDefaultNotebook();
void setNextNotebook();
void fireClearNotes();
void fireNoteAdded(NoteWrapper* note);
void fireClearSearches();
private:
static Cache* m_instance;
static Notebook* m_sel_notebook;
QVector <Tag>* tags;
QVector <Notebook>* notebooks;
QVector <Note>* notes;
QVector <SavedSearch>* searches;
int nextNotebook;
};
#endif // CACHE_H