2016-12-11 16:09:39 +00:00
|
|
|
#ifndef APPLICATION_H
|
|
|
|
#define APPLICATION_H
|
|
|
|
|
|
|
|
#include <stable.h>
|
|
|
|
|
|
|
|
#include "database.h"
|
|
|
|
#include "models/foldermodel.h"
|
2016-12-12 22:33:33 +00:00
|
|
|
#include "models/notemodel.h"
|
2016-12-14 21:50:26 +00:00
|
|
|
#include "models/qmlnote.h"
|
2016-12-27 21:25:07 +01:00
|
|
|
#include "webapi.h"
|
|
|
|
#include "synchronizer.h"
|
2017-01-11 00:28:51 +01:00
|
|
|
#include "window.h"
|
2016-12-11 16:09:39 +00:00
|
|
|
|
|
|
|
namespace jop {
|
|
|
|
|
|
|
|
class Application : public QGuiApplication {
|
|
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
Application(int &argc, char **argv);
|
2017-01-11 00:28:51 +01:00
|
|
|
void login(const QString& email, const QString& password);
|
2016-12-11 16:09:39 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2017-01-11 00:28:51 +01:00
|
|
|
Window view_;
|
2017-01-01 23:03:42 +01:00
|
|
|
Database& db_;
|
2016-12-11 16:09:39 +00:00
|
|
|
FolderModel folderModel_;
|
2016-12-12 22:33:33 +00:00
|
|
|
NoteModel noteModel_;
|
2016-12-23 19:04:26 +01:00
|
|
|
QString selectedFolderId() const;
|
|
|
|
QString selectedNoteId() const;
|
2016-12-14 21:50:26 +00:00
|
|
|
QmlNote selectedQmlNote_;
|
2016-12-27 21:25:07 +01:00
|
|
|
WebApi api_;
|
|
|
|
Synchronizer synchronizer_;
|
2017-01-05 18:59:01 +01:00
|
|
|
QTimer synchronizerTimer_;
|
2016-12-27 21:25:07 +01:00
|
|
|
|
|
|
|
void afterSessionInitialization();
|
2016-12-11 16:09:39 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void view_currentFolderChanged();
|
2016-12-14 21:50:26 +00:00
|
|
|
void view_currentNoteChanged();
|
2016-12-29 20:19:00 +01:00
|
|
|
void view_addNoteButtonClicked();
|
|
|
|
void view_addFolderButtonClicked();
|
2017-01-10 19:59:12 +01:00
|
|
|
void view_syncButtonClicked();
|
|
|
|
|
2016-12-27 21:25:07 +01:00
|
|
|
void api_requestDone(const QJsonObject& response, const QString& tag);
|
2016-12-11 16:09:39 +00:00
|
|
|
|
2017-01-11 00:28:51 +01:00
|
|
|
void dispatcher_loginClicked(const QString &domain, const QString &email, const QString &password);
|
2017-01-11 11:14:57 +01:00
|
|
|
void dispatcher_logoutClicked();
|
2017-01-05 18:59:01 +01:00
|
|
|
|
|
|
|
void synchronizerTimer_timeout();
|
|
|
|
|
2016-12-11 16:09:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // APPLICATION_H
|