Mercurial > hg > syntilista
comparison src/main.h @ 142:36c9cb759326
Implement simple SQLite database backup at program exit using Qt HTTP/HTTPS
and a PHP script on the remote server. Needs more work, testing and better
error handling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 24 Aug 2017 15:44:33 +0300 |
parents | d0943d41f391 |
children | 9f3c0a99bcb1 |
comparison
equal
deleted
inserted
replaced
141:d0943d41f391 | 142:36c9cb759326 |
---|---|
14 #include <QDialog> | 14 #include <QDialog> |
15 #include <QtSql> | 15 #include <QtSql> |
16 #include <QSqlQueryModel> | 16 #include <QSqlQueryModel> |
17 #include <QPainter> | 17 #include <QPainter> |
18 #include <QPrinter> | 18 #include <QPrinter> |
19 #include <QProgressDialog> | |
20 #include <QNetworkAccessManager> | |
21 #include <QNetworkRequest> | |
22 #include <QNetworkReply> | |
23 #include <QHttpMultiPart> | |
19 | 24 |
20 | 25 |
21 // | 26 // |
22 // Global application defines | 27 // Global application defines |
23 // | 28 // |
130 void setActivePerson(qint64 id); | 135 void setActivePerson(qint64 id); |
131 int addTransaction(qint64 id, double value, PersonInfo &info); | 136 int addTransaction(qint64 id, double value, PersonInfo &info); |
132 int addTransactionGUI(qint64 id, bool debt, double value); | 137 int addTransactionGUI(qint64 id, bool debt, double value); |
133 void updatePersonList(); | 138 void updatePersonList(); |
134 void updateTotalBalance(); | 139 void updateTotalBalance(); |
140 void backupDatabase(); | |
135 | 141 |
136 bool printDocumentPage(SLPageInfo &pinfo, const bool getPageInfo, const int page, QPainter *pt, QPrinter *printer); | 142 bool printDocumentPage(SLPageInfo &pinfo, const bool getPageInfo, const int page, QPainter *pt, QPrinter *printer); |
137 | 143 |
138 PersonSQLModel *model_People; | 144 PersonSQLModel *model_People; |
139 | 145 |
169 | 175 |
170 void updateSortOrder(int index, Qt::SortOrder order); | 176 void updateSortOrder(int index, Qt::SortOrder order); |
171 | 177 |
172 void printDocument(QPrinter *printer); | 178 void printDocument(QPrinter *printer); |
173 | 179 |
180 void backupProgress(qint64 bytesSent, qint64 bytesTotal); | |
181 void backupFinished(); | |
182 void backupError(QNetworkReply::NetworkError code); | |
183 | |
174 | 184 |
175 private: | 185 private: |
176 Ui::SyntilistaMainWindow *ui; | 186 Ui::SyntilistaMainWindow *ui; |
187 | |
188 QProgressDialog *backupDialog; | |
189 QNetworkReply *backupReply; | |
177 | 190 |
178 TransactionSQLModel *model_Latest; | 191 TransactionSQLModel *model_Latest; |
179 PersonInfo currPerson; | 192 PersonInfo currPerson; |
180 | 193 |
181 int peopleSortIndex; | 194 int peopleSortIndex; |