1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-06 23:56:13 +02:00
Files
joplin/QtClient/JoplinQtClient/cliapplication.h

76 lines
1.3 KiB
C
Raw Normal View History

2017-01-27 20:26:46 +00:00
#ifndef CLIAPPLICATION_H
#define CLIAPPLICATION_H
#include <stable.h>
2017-01-31 20:19:03 +00:00
#include "command.h"
#include "models/note.h"
2017-03-01 21:01:03 +00:00
#include "webapi.h"
#include "synchronizer.h"
2017-01-31 20:19:03 +00:00
2017-01-27 20:26:46 +00:00
namespace jop {
2017-01-31 20:19:03 +00:00
class StdoutHandler : public QTextStream {
public:
StdoutHandler();
};
class StderrHandler : public QTextStream {
public:
StderrHandler();
};
2017-01-31 20:19:03 +00:00
inline StdoutHandler& qStdout() {
static StdoutHandler r;
return r;
}
inline StderrHandler& qStderr() {
static StderrHandler r;
return r;
}
2017-01-27 20:26:46 +00:00
class CliApplication : public QCoreApplication {
2017-03-01 21:01:03 +00:00
Q_OBJECT
2017-01-27 20:26:46 +00:00
public:
CliApplication(int &argc, char **argv);
2017-02-07 20:11:08 +00:00
~CliApplication();
2017-01-31 20:19:03 +00:00
void processCommand(const Command &command);
2017-01-27 20:26:46 +00:00
int exec();
2017-03-01 21:01:03 +00:00
public slots:
void api_requestDone(const QJsonObject& response, const QString& tag);
void synchronizer_started();
void synchronizer_finished();
signals:
void synchronizationDone();
2017-02-08 21:43:35 +00:00
private:
bool filePutContents(const QString& filePath, const QString& content) const;
2017-03-01 21:01:03 +00:00
void startSynchronization();
2017-02-08 21:43:35 +00:00
QString fileGetContents(const QString& filePath) const;
void saveNoteIfFileChanged(Note& note, const QDateTime& originalLastModified, const QString& noteFilePath);
QStringList parseCommandLinePath(const QString& commandLine) const;
QString commandLineArgsToString(const QStringList& args) const;
2017-03-01 21:01:03 +00:00
WebApi api_;
Synchronizer synchronizer_;
2017-02-08 21:43:35 +00:00
2017-01-27 20:26:46 +00:00
};
}
#endif // CLIAPPLICATION_H