Open-Typer
Open source typewriting tutor program
Loading...
Searching...
No Matches
QmlFileDialog.h
1/*
2 * QmlFileDialog.h
3 * This file is part of Open-Typer
4 *
5 * Copyright (C) 2022-2023 - adazem009
6 *
7 * Open-Typer is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * Open-Typer is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with Open-Typer. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef QMLFILEDIALOG_H
22#define QMLFILEDIALOG_H
23
24#include <QObject>
25
30class Q_DECL_EXPORT QmlFileDialog : public QObject
31{
32 Q_OBJECT
33 Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged)
34 Q_PROPERTY(bool showAllFiles READ showAllFiles WRITE setShowAllFiles NOTIFY showAllFilesChanged)
35 Q_PROPERTY(QString fileName READ fileName NOTIFY fileNameChanged)
36 Q_PROPERTY(QString shortFileName READ shortFileName NOTIFY shortFileNameChanged)
37 Q_PROPERTY(QString defaultSuffix READ defaultSuffix WRITE setDefaultSuffix NOTIFY defaultSuffixChanged)
38 public:
39 QStringList nameFilters(void);
40 void setNameFilters(QStringList filters);
41
42 bool showAllFiles(void);
43 void setShowAllFiles(bool value);
44
45 QString fileName(void);
46 QString shortFileName(void);
47
48 const QString &defaultSuffix() const;
49 void setDefaultSuffix(const QString &newDefaultSuffix);
50
51 Q_INVOKABLE void getOpenFileContent(void);
52 Q_INVOKABLE QString getSaveFileName();
53
54 private:
55 QString getFilters();
56
57 QStringList m_nameFilters;
58 bool m_showAllFiles = true;
59 QString m_fileName;
60 QString m_defaultSuffix;
61
62 signals:
63 void nameFiltersChanged(QStringList filters);
64 void showAllFilesChanged(bool value);
65 void fileNameChanged(QString name);
66 void shortFileNameChanged(QString name);
67 void fileContentReady(QString content);
68 void defaultSuffixChanged();
69};
70
71#endif // QMLFILEDIALOG_H
The QmlFileDialog class provides a file dialog for QML. This file dialog supports file uploads on Web...
Definition QmlFileDialog.h:31