QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCFileDialogController.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QObject>
4#include <QtCore/QUrl>
5#include <QtQmlIntegration/QtQmlIntegration>
6
7class QGCFileDialogController : public QObject
8{
9 Q_OBJECT
10 QML_ELEMENT
11 QML_SINGLETON
12
13public:
14 explicit QGCFileDialogController(QObject *parent = nullptr);
16
18 Q_INVOKABLE static QStringList getFiles(const QString &directoryPath, const QStringList &nameFilters);
19
22 Q_INVOKABLE static QString fullyQualifiedFilename(const QString &directoryPath, const QString &filename, const QStringList &nameFilters = QStringList());
23
25 Q_INVOKABLE static bool fileExists(const QString &filename);
26
28 Q_INVOKABLE static void deleteFile(const QString &filename);
29
30 Q_INVOKABLE static QString urlToLocalFile(QUrl url);
31
33 Q_INVOKABLE static QUrl localFileToUrl(const QString &localFile);
34
38 Q_INVOKABLE static QString fullFolderPathToShortMobilePath(const QString &fullFolderPath);
39
42 Q_INVOKABLE void importFromNativePicker();
43
52
54 Q_INVOKABLE static bool testHookArmed();
55
57 Q_INVOKABLE static QString takeTestNextFile();
58
59#ifdef QGC_UNITTEST_BUILD
61 static void setTestNextFileForAccept(const QString &file);
62
64 static void setTestRejectNext();
65#endif
67
68signals:
71 void fileImported(const QString& filePath);
72
75 void importFailed(const QString& errorMessage);
76
77private:
78#ifdef Q_OS_ANDROID
79 void _handleImportResult(const QString& filePath);
80#endif
81};
void fileImported(const QString &filePath)
static Q_INVOKABLE bool fileExists(const QString &filename)
Check for file existence of specified fully qualified file name.
static Q_INVOKABLE QString fullFolderPathToShortMobilePath(const QString &fullFolderPath)
static Q_INVOKABLE QString takeTestNextFile()
Returns the armed file path (empty for reject) and disarms the hook.
static Q_INVOKABLE QString urlToLocalFile(QUrl url)
static Q_INVOKABLE bool testHookArmed()
Returns true if a test result has been armed for the next dialog open.
static Q_INVOKABLE void deleteFile(const QString &filename)
Deletes the file specified by the fully qualified file name.
static Q_INVOKABLE QStringList getFiles(const QString &directoryPath, const QStringList &nameFilters)
Return all file in the specified path which match the specified extension.
Q_INVOKABLE void importFromNativePicker()
static Q_INVOKABLE QUrl localFileToUrl(const QString &localFile)
Converts a local file path to a properly formed file:// url.
static Q_INVOKABLE QString fullyQualifiedFilename(const QString &directoryPath, const QString &filename, const QStringList &nameFilters=QStringList())
void importFailed(const QString &errorMessage)