CuteLogger
Fast and simple logging solution for Qt based applications
qmlfile.h
1 /*
2  * Copyright (c) 2014-2016 Meltytech, LLC
3  * Author: Brian Matherly <pez4brian@yahoo.com>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef QMLFILE_H
20 #define QMLFILE_H
21 
22 #include <QObject>
23 #include <QUrl>
24 
25 class QmlFile : public QObject
26 {
27  Q_OBJECT
28  Q_PROPERTY(QString url READ getUrl WRITE setUrl NOTIFY urlChanged)
29  Q_PROPERTY(QString fileName READ getFileName)
30  Q_PROPERTY(QString path READ getPath)
31 
32 public:
33  explicit QmlFile(QObject *parent = 0);
34  QString getUrl();
35  void setUrl(const QString& text);
36  QString getFileName();
37  QString getPath();
38  Q_INVOKABLE void copyFromFile(QString source);
39  Q_INVOKABLE bool exists();
40  Q_INVOKABLE QString suffix();
41 
42 signals:
43  void urlChanged(const QUrl &url);
44 
45 private:
46  QUrl m_url;
47 };
48 
49 #endif // QMLFILE_H