mirror of
https://github.com/laurent22/joplin.git
synced 2025-02-01 19:15:01 +02:00
Tweaks for Android version
This commit is contained in:
parent
228831bf23
commit
ceae7b9fde
80
QtClient/JoplinQtClient/AndroidManifest.xml
Executable file
80
QtClient/JoplinQtClient/AndroidManifest.xml
Executable file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0"?>
|
||||
<manifest package="net.cozic.joplin" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
|
||||
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Joplin">
|
||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="Joplin" android:screenOrientation="unspecified" android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
|
||||
<!-- Application arguments -->
|
||||
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
|
||||
<!-- Application arguments -->
|
||||
|
||||
<meta-data android:name="android.app.lib_name" android:value="Joplin"/>
|
||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
<!-- Deploy Qt libs as part of package -->
|
||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
|
||||
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||
<!-- Run with local libs -->
|
||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="1"/>
|
||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||
<meta-data android:name="android.app.load_local_libs" android:value="plugins/platforms/android/libqtforandroid.so:plugins/bearer/libqandroidbearer.so:lib/libQt5QuickParticles.so"/>
|
||||
<meta-data android:name="android.app.load_local_jars" android:value="jar/QtAndroid.jar:jar/QtAndroid-bundled.jar:jar/QtAndroidBearer.jar:jar/QtAndroidBearer-bundled.jar"/>
|
||||
<meta-data android:name="android.app.static_init_classes" android:value=""/>
|
||||
<!-- Messages maps -->
|
||||
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
|
||||
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||
<!-- Messages maps -->
|
||||
|
||||
<!-- Splash screen -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
|
||||
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
|
||||
<!-- Splash screen -->
|
||||
|
||||
<!-- Background running -->
|
||||
<!-- Warning: changing this value to true may cause unexpected crashes if the
|
||||
application still try to draw after
|
||||
"applicationStateChanged(Qt::ApplicationSuspended)"
|
||||
signal is sent! -->
|
||||
<meta-data android:name="android.app.background_running" android:value="false"/>
|
||||
<!-- Background running -->
|
||||
|
||||
<!-- auto screen scale factor -->
|
||||
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
|
||||
<!-- auto screen scale factor -->
|
||||
|
||||
<!-- extract android style -->
|
||||
<!-- available android:values :
|
||||
* full - useful QWidget & Quick Controls 1 apps
|
||||
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
|
||||
* none - useful for apps that don't use any of the above Qt modules
|
||||
-->
|
||||
<meta-data android:name="android.app.extract_android_style" android:value="full"/>
|
||||
<!-- extract android style -->
|
||||
</activity>
|
||||
|
||||
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
|
||||
|
||||
</application>
|
||||
|
||||
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
|
||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default permissions. -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default features. -->
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
|
||||
|
||||
</manifest>
|
@ -20,7 +20,8 @@ SOURCES += \
|
||||
dispatcher.cpp \
|
||||
models/change.cpp \
|
||||
models/basemodel.cpp \
|
||||
models/setting.cpp
|
||||
models/setting.cpp \
|
||||
paths.cpp
|
||||
|
||||
RESOURCES += qml.qrc \
|
||||
database.qrc
|
||||
@ -54,9 +55,11 @@ HEADERS += \
|
||||
models/change.h \
|
||||
models/basemodel.h \
|
||||
enum.h \
|
||||
models/setting.h
|
||||
models/setting.h \
|
||||
paths.h
|
||||
|
||||
DISTFILES +=
|
||||
DISTFILES += \
|
||||
AndroidManifest.xml
|
||||
|
||||
PRECOMPILED_HEADER = stable.h
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "settings.h"
|
||||
#include "uuid.h"
|
||||
#include "dispatcher.h"
|
||||
#include "paths.h"
|
||||
|
||||
using namespace jop;
|
||||
|
||||
@ -15,14 +16,12 @@ Application::Application(int &argc, char **argv) :
|
||||
QGuiApplication(argc, argv),
|
||||
db_(jop::db()),
|
||||
api_("http://joplin.local"),
|
||||
//api_("https://joplin.cozic.net"),
|
||||
synchronizer_(api_.baseUrl(), db_),
|
||||
folderModel_(db_)
|
||||
|
||||
{
|
||||
|
||||
QString dbPath = "D:/Web/www/joplin/QtClient/data/notes.sqlite";
|
||||
jop::db().initialize(dbPath);
|
||||
|
||||
// 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.
|
||||
@ -30,6 +29,11 @@ Application::Application(int &argc, char **argv) :
|
||||
QCoreApplication::setOrganizationDomain("cozic.net");
|
||||
QCoreApplication::setApplicationName("Joplin");
|
||||
|
||||
qDebug() << "Config dir:" << paths::configDir();
|
||||
qDebug() << "Database file:" << paths::databaseFile();
|
||||
|
||||
jop::db().initialize(paths::databaseFile());
|
||||
|
||||
Settings::initialize();
|
||||
|
||||
Settings settings;
|
||||
|
@ -46,6 +46,7 @@ bool BaseModel::load(const QString &id) {
|
||||
if (!q.isValid()) return false;
|
||||
|
||||
loadSqlQuery(q);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BaseModel::save(bool trackChanges) {
|
||||
|
21
QtClient/JoplinQtClient/paths.cpp
Executable file
21
QtClient/JoplinQtClient/paths.cpp
Executable file
@ -0,0 +1,21 @@
|
||||
#include "paths.h"
|
||||
|
||||
using namespace jop;
|
||||
|
||||
QString configDir_ = "";
|
||||
|
||||
QString paths::configDir() {
|
||||
if (configDir_ != "") return configDir_;
|
||||
|
||||
configDir_ = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/" + QCoreApplication::applicationName();
|
||||
QDir d(configDir_);
|
||||
if (!d.exists()) {
|
||||
bool dirCreated = d.mkpath(".");
|
||||
if (!dirCreated) qFatal(QString("Cannot create config directory: " + configDir_).toLatin1());
|
||||
}
|
||||
return configDir_;
|
||||
}
|
||||
|
||||
QString paths::databaseFile() {
|
||||
return QString("%1/%2.sqlite").arg(configDir()).arg(QCoreApplication::applicationName());
|
||||
}
|
15
QtClient/JoplinQtClient/paths.h
Executable file
15
QtClient/JoplinQtClient/paths.h
Executable file
@ -0,0 +1,15 @@
|
||||
#ifndef PATHS_H
|
||||
#define PATHS_H
|
||||
|
||||
#include <stable.h>
|
||||
|
||||
namespace jop {
|
||||
namespace paths {
|
||||
|
||||
QString configDir();
|
||||
QString databaseFile();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PATHS_H
|
@ -6,6 +6,7 @@ using namespace jop;
|
||||
Settings::Settings() : QSettings() {}
|
||||
|
||||
bool readSqlite(QIODevice &device, QSettings::SettingsMap &map) {
|
||||
Q_UNUSED(device);
|
||||
map = Setting::settings();
|
||||
return true;
|
||||
}
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include <QBuffer>
|
||||
#include <QJsonArray>
|
||||
#include <QTimer>
|
||||
#include <QStandardPaths>
|
||||
#include <QDir>
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
@ -39,7 +39,7 @@ void WebApi::setSessionId(const QString &v) {
|
||||
|
||||
void WebApi::processQueue() {
|
||||
if (!queuedRequests_.size() || inProgressRequests_.size() >= 50) return;
|
||||
QueuedRequest& r = queuedRequests_.takeFirst();
|
||||
QueuedRequest r = queuedRequests_.takeFirst();
|
||||
|
||||
QString url = baseUrl_ + "/" + r.path;
|
||||
QUrlQuery query = r.query;
|
||||
|
Loading…
x
Reference in New Issue
Block a user