WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
ZTableFile.h
Go to the documentation of this file.
1 /*
2  * Zuble - A run-time system for QML/Javascript applications
3  * Copyright (C) 2015 Bob Dinitto
4  *
5  * Filename: ZTableFile.h
6  * Created on: 06-Jul-2015
7  * Author: Bob Dinitto
8  *
9  * Zuble is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 #ifndef ZTABLEFILE_H
26 #define ZTABLEFILE_H
27 
28 #include <QObject>
29 //#include <QFile>
30 #include <QFileSystemWatcher>
31 #include <QVariant>
32 #include "zglobal.h"
33 
34 namespace Zbl
35 {
36 
37 class ZTableModel;
38 
44 class ZTableFile : public QObject
45 {
46  Q_OBJECT
47 public:
48  explicit ZTableFile(QObject *parent = 0);
49 
57  Q_INVOKABLE bool readFile(const QString& filePath);
58 
63  Q_INVOKABLE bool writeFile(const QString& filePath);
64 
65 
66 signals:
67 
74  void fileModified(const QString& path);
75 
76 public slots:
77 
78 protected:
79 
81 
82  void validateWatcher();
83 
84 
89  QString m_filePath;
90 
96  QFileSystemWatcher* m_watcher;
97 
103 
104 
105  static qint64 m_maxFileBytes;
106 
107 };
108 
109 } // Zbl
110 
111 #endif // ZTABLEFILE_H
Q_INVOKABLE bool writeFile(const QString &filePath)
Writes the data table to the specified file. Returns true if successful; otherwise returns false...
Definition: ZTableFile.cpp:172
#define ZBL_DECLARE_LOGGED_OBJECT
Definition: zglobal.h:94
QFileSystemWatcher * m_watcher
Monitors table data file for updates from this and other applications.
Definition: ZTableFile.h:96
ZTableFile(QObject *parent=0)
Definition: ZTableFile.cpp:41
Q_INVOKABLE bool readFile(const QString &filePath)
Reads the specified table file into the data table. Previous data in the table is discarded...
Definition: ZTableFile.cpp:79
ZBL_DECLARE_LOGGED_OBJECT void validateWatcher()
Definition: ZTableFile.cpp:57
ZTableModel * m_data
The data model that will send or receive data.
Definition: ZTableFile.h:102
static qint64 m_maxFileBytes
Definition: ZTableFile.h:105
Definition: ZAndGate.cpp:6
This two dimensional table model is used to store and manipulate data.
Definition: ZTableModel.h:96
void fileModified(const QString &path)
Sent whenever the data file is modified by this or other programs.
QString m_filePath
Path to the file that was last read or written.
Definition: ZTableFile.h:89
This class in theory allows reading and writing of ZTableModel objects to JSON files. (TBD: currently unused/untested?)
Definition: ZTableFile.h:44