You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Added sync button
This commit is contained in:
@ -56,7 +56,8 @@ HEADERS += \
|
||||
models/basemodel.h \
|
||||
enum.h \
|
||||
models/setting.h \
|
||||
paths.h
|
||||
paths.h \
|
||||
constants.h
|
||||
|
||||
DISTFILES += \
|
||||
AndroidManifest.xml
|
||||
|
@ -9,13 +9,14 @@
|
||||
#include "uuid.h"
|
||||
#include "dispatcher.h"
|
||||
#include "paths.h"
|
||||
#include "constants.h"
|
||||
|
||||
using namespace jop;
|
||||
|
||||
Application::Application(int &argc, char **argv) :
|
||||
QGuiApplication(argc, argv),
|
||||
db_(jop::db()),
|
||||
api_("http://joplin.local"),
|
||||
api_(jop::API_BASE_URL),
|
||||
//api_("https://joplin.cozic.net"),
|
||||
synchronizer_(api_.baseUrl(), db_),
|
||||
folderModel_(db_)
|
||||
@ -25,9 +26,9 @@ Application::Application(int &argc, char **argv) :
|
||||
// This is linked to where the QSettings will be saved. In other words,
|
||||
// if these values are changed, the settings will be reset and saved
|
||||
// somewhere else.
|
||||
QCoreApplication::setOrganizationName("Cozic");
|
||||
QCoreApplication::setOrganizationDomain("cozic.net");
|
||||
QCoreApplication::setApplicationName("Joplin");
|
||||
QCoreApplication::setOrganizationName(jop::ORG_NAME);
|
||||
QCoreApplication::setOrganizationDomain(jop::ORG_DOMAIN);
|
||||
QCoreApplication::setApplicationName(jop::APP_NAME);
|
||||
|
||||
qDebug() << "Config dir:" << paths::configDir();
|
||||
qDebug() << "Database file:" << paths::databaseFile();
|
||||
@ -51,6 +52,7 @@ Application::Application(int &argc, char **argv) :
|
||||
connect(rootObject, SIGNAL(currentFolderChanged()), this, SLOT(view_currentFolderChanged()));
|
||||
connect(rootObject, SIGNAL(currentNoteChanged()), this, SLOT(view_currentNoteChanged()));
|
||||
connect(rootObject, SIGNAL(addFolderButtonClicked()), this, SLOT(view_addFolderButtonClicked()));
|
||||
connect(rootObject, SIGNAL(syncButtonClicked()), this, SLOT(view_syncButtonClicked()));
|
||||
|
||||
connect(&dispatcher(), SIGNAL(folderCreated(QString)), this, SLOT(dispatcher_folderCreated(QString)));
|
||||
connect(&dispatcher(), SIGNAL(folderUpdated(QString)), this, SLOT(dispatcher_folderUpdated(QString)));
|
||||
@ -58,7 +60,7 @@ Application::Application(int &argc, char **argv) :
|
||||
|
||||
view_.show();
|
||||
|
||||
synchronizerTimer_.setInterval(1000 * 10);
|
||||
synchronizerTimer_.setInterval(1000 * 120);
|
||||
synchronizerTimer_.start();
|
||||
|
||||
connect(&synchronizerTimer_, SIGNAL(timeout()), this, SLOT(synchronizerTimer_timeout()));
|
||||
@ -168,3 +170,7 @@ void Application::view_addFolderButtonClicked() {
|
||||
|
||||
//qDebug() << "Added" << q.lastInsertId().toString();
|
||||
}
|
||||
|
||||
void Application::view_syncButtonClicked() {
|
||||
synchronizer_.start();
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ public slots:
|
||||
void view_currentNoteChanged();
|
||||
void view_addNoteButtonClicked();
|
||||
void view_addFolderButtonClicked();
|
||||
void view_syncButtonClicked();
|
||||
|
||||
void api_requestDone(const QJsonObject& response, const QString& tag);
|
||||
|
||||
void dispatcher_folderCreated(const QString& folderId);
|
||||
|
15
QtClient/JoplinQtClient/constants.h
Executable file
15
QtClient/JoplinQtClient/constants.h
Executable file
@ -0,0 +1,15 @@
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
|
||||
#include <stable.h>
|
||||
|
||||
namespace jop {
|
||||
|
||||
const QString ORG_NAME = "Cozic";
|
||||
const QString ORG_DOMAIN = "cozic.net";
|
||||
const QString APP_NAME = "Joplin";
|
||||
const QString API_BASE_URL = "https://joplin.cozic.net";
|
||||
|
||||
}
|
||||
|
||||
#endif // CONSTANTS_H
|
@ -11,6 +11,7 @@ Item {
|
||||
signal currentNoteChanged()
|
||||
signal addNoteButtonClicked()
|
||||
signal addFolderButtonClicked()
|
||||
signal syncButtonClicked()
|
||||
property alias currentFolderIndex: folderList.currentIndex
|
||||
property alias currentNoteIndex: noteList.currentIndex
|
||||
|
||||
@ -91,4 +92,12 @@ Item {
|
||||
onAddNoteButtonClicked: root.addNoteButtonClicked()
|
||||
}
|
||||
|
||||
Button {
|
||||
id: syncButton
|
||||
text: "Sync"
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
onClicked: root.syncButtonClicked()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ Synchronizer::Synchronizer(const QString &apiUrl, Database &database) : api_(api
|
||||
qDebug() << api_.baseUrl();
|
||||
state_ = Idle;
|
||||
uploadsRemaining_ = 0;
|
||||
//downloadsRemaining_ = 0;
|
||||
connect(&api_, SIGNAL(requestDone(QJsonObject,QString)), this, SLOT(api_requestDone(QJsonObject,QString)));
|
||||
}
|
||||
|
||||
@ -53,13 +52,6 @@ void Synchronizer::checkNextState() {
|
||||
case DownloadingChanges:
|
||||
|
||||
switchState(Idle);
|
||||
|
||||
// if (downloadsRemaining_ < 0) qCritical() << "Mismatch on download operations done" << downloadsRemaining_;
|
||||
|
||||
// if (downloadsRemaining_ <= 0) {
|
||||
// downloadsRemaining_ = 0;
|
||||
// switchState(Idle);
|
||||
// }
|
||||
break;
|
||||
|
||||
case Idle:
|
||||
|
@ -27,7 +27,6 @@ private:
|
||||
Database& db_;
|
||||
SynchronizationState state_;
|
||||
int uploadsRemaining_;
|
||||
int downloadsRemaining_;
|
||||
void checkNextState();
|
||||
void switchState(SynchronizationState state);
|
||||
|
||||
|
Reference in New Issue
Block a user