9 #ifndef hifi_ui_FileDialogHelper_h
10 #define hifi_ui_FileDialogHelper_h
12 #include <QtCore/QFileSystemWatcher>
13 #include <QtCore/QObject>
14 #include <QtCore/QStandardPaths>
15 #include <QtCore/QString>
16 #include <QtCore/QStringList>
17 #include <QtCore/QUrl>
21 class FileDialogHelper :
public QObject {
23 Q_ENUMS(StandardLocation)
27 enum StandardLocation {
44 GenericConfigLocation,
47 AppLocalDataLocation = DataLocation
50 Q_INVOKABLE QUrl home();
51 Q_INVOKABLE QStringList standardPath(StandardLocation location);
52 Q_INVOKABLE QString writableLocation(StandardLocation location);
53 Q_INVOKABLE QStringList drives();
54 Q_INVOKABLE QString urlToPath(
const QUrl& url);
55 Q_INVOKABLE
bool urlIsDir(
const QUrl& url);
56 Q_INVOKABLE
bool urlIsFile(
const QUrl& url);
57 Q_INVOKABLE
bool urlExists(
const QUrl& url);
58 Q_INVOKABLE
bool urlIsWritable(
const QUrl& url);
59 Q_INVOKABLE
bool fileExists(
const QString& path);
60 Q_INVOKABLE
bool validPath(
const QString& path);
61 Q_INVOKABLE
bool validFolder(
const QString& path);
62 Q_INVOKABLE QUrl pathToUrl(
const QString& path);
63 Q_INVOKABLE QUrl saveHelper(
const QString& saveText,
const QUrl& currentFolder,
const QStringList& selectionFilters);
64 Q_INVOKABLE QList<QUrl> urlToList(
const QUrl& url);
66 static void setOpenDirectoryOperator(std::function<
void(
const QString&)> openDirectoryOperator) { _openDirectoryOperator = openDirectoryOperator; }
67 Q_INVOKABLE
void openDirectory(
const QString& path);
69 Q_INVOKABLE
void monitorDirectory(
const QString& path);
72 void contentsChanged();
75 QFileSystemWatcher _fsWatcher;
76 QString _fsWatcherPath;
77 static std::function<void(
const QString&)> _openDirectoryOperator;