Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAndroidUtils.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-3.0-or-later
3 */
4#ifndef __KISANDROIDUTILS_H_
5#define __KISANDROIDUTILS_H_
6
7#include <QString>
8#include <kritaglobal_export.h>
9
10class QTemporaryFile;
11
12namespace KisAndroidUtils
13{
14
15// Installs the Android log handler and copies assets.
16KRITAGLOBAL_EXPORT void performInitialSetup();
17
18// Check whether we seem to be running on a Xiaomi device, which requires
19// enabling several workarounds by default. If we need additional workarounds
20// in the future, change this to return an enum or a flag set instead, depending
21// on what's actually needed.
22KRITAGLOBAL_EXPORT bool looksLikeXiaomiDevice();
23
24// Check whether we seem to be running a device with broken stylus cursors that
25// show up while hovering and then disappear when pressing them down, which is
26// immensely annoying and needs to be worked around. We consider this to be the
27// case for Wacom and XPPEN devices.
28KRITAGLOBAL_EXPORT bool looksLikeBrokenCursorDevice();
29
30// Checks whether the below setHideTouchAndStylusCursors is supported on this
31// patched version of Qt.
32KRITAGLOBAL_EXPORT bool canHideTouchAndStylusCursors();
33
34// Hides cursors on touch and stylus events made with internal devices. If the
35// method doesn't exist, such as when using an outdated patched Qt, this will
36// do nothing. Use the above canHideTouchAndStylusCursors to check in advance.
37KRITAGLOBAL_EXPORT void setHideTouchAndStylusCursors(bool hide);
38
39// Check whether the device supports reporting low-memory situations as an exit
40// reason. Devices that don't will instead report a SIGKILL.
41KRITAGLOBAL_EXPORT bool isLowMemoryKillReportSupported();
42
43// Checks , logs and clears the pending exception in the Java Native Interface.
44// If an exception occurs while one is pending, the application dies. Some Qt
45// stuff, such as QDesktopServices, can throw JNI errors and don't clear them.
46KRITAGLOBAL_EXPORT void clearJniException(const QString &location);
47
48// Checks whether we are in immersive mode, which is basically full-screen.
49KRITAGLOBAL_EXPORT bool isInFullScreen();
50
51// Enters or exits immersive mode if we're not in that state already.
52KRITAGLOBAL_EXPORT void setFullScreen(bool fullScreen);
53
54// QFile::copy doesn't work on sandboxed directories, use this instead. The
55// value placed in outErrorMessage is not translated, use it for logging or
56// present it to the user as an internal error. On success, it will be cleared.
57KRITAGLOBAL_EXPORT bool
58copyFile(const QString &inputPath, const QString &outputPath, QString *outErrorMessage = nullptr);
59
60KRITAGLOBAL_EXPORT bool
61copyFileToTemporary(const QString &inputPath, QTemporaryFile &outputFile, QString *outErrorMessage = nullptr);
62
63} // namespace KisAndroidUtils
64
65#endif // __KISANDROIDUTILS_H_
void setHideTouchAndStylusCursors(bool hide)
bool isLowMemoryKillReportSupported()
bool looksLikeBrokenCursorDevice()
bool copyFile(const QString &inputPath, const QString &outputPath, QString *outErrorMessage)
bool canHideTouchAndStylusCursors()
void setFullScreen(bool fullScreen)
void clearJniException(const QString &location)
bool copyFileToTemporary(const QString &inputPath, QTemporaryFile &outputFile, QString *outErrorMessage)