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
35 Q_INVOKABLE static QString fullFolderPathToShortMobilePath(const QString &fullFolderPath);
36
39 Q_INVOKABLE void importFromNativePicker();
40
49
51 Q_INVOKABLE static bool testHookArmed();
52
54 Q_INVOKABLE static QString takeTestNextFile();
55
56#ifdef QGC_UNITTEST_BUILD
58 static void setTestNextFileForAccept(const QString &file);
59
61 static void setTestRejectNext();
62#endif
64
65signals:
68 void fileImported(const QString& filePath);
69
72 void importFailed(const QString& errorMessage);
73
74private:
75#ifdef Q_OS_ANDROID
76 void _handleImportResult(const QString& filePath);
77#endif
78};
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 QString fullyQualifiedFilename(const QString &directoryPath, const QString &filename, const QStringList &nameFilters=QStringList())
void importFailed(const QString &errorMessage)