mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-06 22:46:29 +02:00
Setup for CLI app
This commit is contained in:
parent
99666740e8
commit
2fbbdbdb34
@ -44,7 +44,8 @@ SOURCES += \
|
|||||||
paths.cpp \
|
paths.cpp \
|
||||||
window.cpp \
|
window.cpp \
|
||||||
filters.cpp \
|
filters.cpp \
|
||||||
models/abstractlistmodel.cpp
|
models/abstractlistmodel.cpp \
|
||||||
|
cliapplication.cpp
|
||||||
|
|
||||||
RESOURCES += qml.qrc \
|
RESOURCES += qml.qrc \
|
||||||
database.qrc
|
database.qrc
|
||||||
@ -81,7 +82,8 @@ HEADERS += \
|
|||||||
constants.h \
|
constants.h \
|
||||||
window.h \
|
window.h \
|
||||||
filters.h \
|
filters.h \
|
||||||
models/abstractlistmodel.h
|
models/abstractlistmodel.h \
|
||||||
|
cliapplication.h
|
||||||
|
|
||||||
defined(JOP_FRONT_END_GUI, var) {
|
defined(JOP_FRONT_END_GUI, var) {
|
||||||
SOURCES += application.cpp
|
SOURCES += application.cpp
|
||||||
|
41
QtClient/JoplinQtClient/cliapplication.cpp
Normal file
41
QtClient/JoplinQtClient/cliapplication.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#include <stab.h>
|
||||||
|
|
||||||
|
#include "cliapplication.h"
|
||||||
|
#include "constants.h"
|
||||||
|
#include "database.h"
|
||||||
|
#include "paths.h"
|
||||||
|
#include "uuid.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
namespace jop {
|
||||||
|
|
||||||
|
CliApplication::CliApplication(int &argc, char **argv) : QCoreApplication(argc, 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(jop::ORG_NAME);
|
||||||
|
QCoreApplication::setOrganizationDomain(jop::ORG_DOMAIN);
|
||||||
|
QCoreApplication::setApplicationName(jop::APP_NAME);
|
||||||
|
|
||||||
|
qInfo() << "Config dir:" << paths::configDir();
|
||||||
|
qInfo() << "Database file:" << paths::databaseFile();
|
||||||
|
qInfo() << "SSL:" << QSslSocket::sslLibraryBuildVersionString() << QSslSocket::sslLibraryVersionNumber();
|
||||||
|
|
||||||
|
jop::db().initialize(paths::databaseFile());
|
||||||
|
|
||||||
|
Settings::initialize();
|
||||||
|
|
||||||
|
Settings settings;
|
||||||
|
|
||||||
|
if (!settings.contains("clientId")) {
|
||||||
|
// Client ID should be unique per instance of a program
|
||||||
|
settings.setValue("clientId", uuid::createUuid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CliApplication::exec() {
|
||||||
|
qDebug() << "exec";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
19
QtClient/JoplinQtClient/cliapplication.h
Normal file
19
QtClient/JoplinQtClient/cliapplication.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#ifndef CLIAPPLICATION_H
|
||||||
|
#define CLIAPPLICATION_H
|
||||||
|
|
||||||
|
#include <stable.h>
|
||||||
|
|
||||||
|
namespace jop {
|
||||||
|
|
||||||
|
class CliApplication : public QCoreApplication {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
CliApplication(int &argc, char **argv);
|
||||||
|
int exec();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // CLIAPPLICATION_H
|
@ -9,6 +9,12 @@ const QString ORG_NAME = "Cozic";
|
|||||||
const QString ORG_DOMAIN = "cozic.net";
|
const QString ORG_DOMAIN = "cozic.net";
|
||||||
const QString APP_NAME = "Joplin";
|
const QString APP_NAME = "Joplin";
|
||||||
|
|
||||||
|
#if defined(JOP_FRONT_END_CLI)
|
||||||
|
const QString FRONT_END = "cli";
|
||||||
|
#elif defined(JOP_FRONT_END_GUI)
|
||||||
|
const QString FRONT_END = "gui";
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CONSTANTS_H
|
#endif // CONSTANTS_H
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
#include <stable.h>
|
#include <stable.h>
|
||||||
|
|
||||||
|
#if defined(JOP_FRONT_END_CLI)
|
||||||
|
#include "cliapplication.h"
|
||||||
|
#elif defined(JOP_FRONT_END_GUI)
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "models/folder.h"
|
#include "models/folder.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "models/foldermodel.h"
|
#include "models/foldermodel.h"
|
||||||
@ -26,7 +31,7 @@ int main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JOP_FRONT_END_CLI
|
#ifdef JOP_FRONT_END_CLI
|
||||||
QCoreApplication app(argc, argv);
|
CliApplication app(argc, argv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
|
#include <QCoreApplication>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user