mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Android: use a sharable location for our files
The first location we should try is one that allows us to share files. In theory this should work on every device, but we do have a few fall-backs, just in case. This also moves the Android specific include to the top which seems much more standard. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
aa41fbbf79
commit
43ed2e1224
2 changed files with 7 additions and 5 deletions
|
@ -48,7 +48,8 @@ bool subsurface_ignore_font(const char *font)
|
||||||
static const char *system_default_path_append(const char *append)
|
static const char *system_default_path_append(const char *append)
|
||||||
{
|
{
|
||||||
// Qt appears to find a working path for us - let's just go with that
|
// Qt appears to find a working path for us - let's just go with that
|
||||||
QString path = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
|
// AppDataLocation allows potential sharing of the files we put there
|
||||||
|
QString path = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).first();
|
||||||
|
|
||||||
if (append)
|
if (append)
|
||||||
path += QString("/%1").arg(append);
|
path += QString("/%1").arg(append);
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "commands/command.h"
|
#include "commands/command.h"
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
|
#include <QtAndroid>
|
||||||
#include "core/serial_usb_android.h"
|
#include "core/serial_usb_android.h"
|
||||||
std::vector<android_usb_serial_device_descriptor> androidSerialDevices;
|
std::vector<android_usb_serial_device_descriptor> androidSerialDevices;
|
||||||
|
|
||||||
|
@ -230,9 +231,11 @@ QMLManager::QMLManager() :
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
// on Android we first try the GenericDataLocation (typically /storage/emulated/0) and if that fails
|
// on Android we first try the AppDataLocation (which allows sharing of files), then the
|
||||||
// (as happened e.g. on a Sony Xperia phone) we try several other default locations, with the TempLocation as last resort
|
// GenericDataLocation (typically /storage/emulated/0), and if that fails (as happened e.g. on a
|
||||||
|
// Sony Xperia phone) we try several other default locations, with the TempLocation as last resort
|
||||||
QStringList fileLocations =
|
QStringList fileLocations =
|
||||||
|
QStandardPaths::standardLocations(QStandardPaths::AppDataLocation) +
|
||||||
QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation) +
|
QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation) +
|
||||||
QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation) +
|
QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation) +
|
||||||
QStandardPaths::standardLocations(QStandardPaths::DownloadLocation) +
|
QStandardPaths::standardLocations(QStandardPaths::DownloadLocation) +
|
||||||
|
@ -1826,8 +1829,6 @@ void QMLManager::writeToAppLogFile(QString logText)
|
||||||
//HACK to color the system bar on Android, use qtandroidextras and call the appropriate Java methods
|
//HACK to color the system bar on Android, use qtandroidextras and call the appropriate Java methods
|
||||||
//this code is based on code in the Kirigami example app for Android (under LGPL-2) Copyright 2017 Marco Martin
|
//this code is based on code in the Kirigami example app for Android (under LGPL-2) Copyright 2017 Marco Martin
|
||||||
|
|
||||||
#include <QtAndroid>
|
|
||||||
|
|
||||||
// there doesn't appear to be an include that defines these in an easily accessible way
|
// there doesn't appear to be an include that defines these in an easily accessible way
|
||||||
// WindowManager.LayoutParams
|
// WindowManager.LayoutParams
|
||||||
#define FLAG_TRANSLUCENT_STATUS 0x04000000
|
#define FLAG_TRANSLUCENT_STATUS 0x04000000
|
||||||
|
|
Loading…
Reference in a new issue