comparison src/main.h @ 150:2a8c97753381

Make the backup stuff compile-time optional.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 28 Aug 2017 11:24:42 +0300
parents fd960e586678
children 0a7aff5dce3b
comparison
equal deleted inserted replaced
149:fd960e586678 150:2a8c97753381
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> 19 #include <QProgressDialog>
20 #include <QNetworkAccessManager> 20 #ifdef USE_QTHTTP
21 #include <QNetworkRequest> 21 # include <QNetworkAccessManager>
22 #include <QNetworkReply> 22 # include <QNetworkRequest>
23 #include <QHttpMultiPart> 23 # include <QNetworkReply>
24 # include <QHttpMultiPart>
25 #endif
26 #ifdef USE_LIBCURL
27 # include <curl/curl.h>
28 #endif
24 29
25 30
26 // 31 //
27 // Global application defines 32 // Global application defines
28 // 33 //
34 39
35 // SQL database field width/lengths 40 // SQL database field width/lengths
36 #define SQL_LEN_FIRST_NAME 128 41 #define SQL_LEN_FIRST_NAME 128
37 #define SQL_LEN_LAST_NAME 128 42 #define SQL_LEN_LAST_NAME 128
38 #define SQL_LEN_EXTRA_INFO 2048 43 #define SQL_LEN_EXTRA_INFO 2048
44
45 // Supported database backup modes
46 #define BACKUP_NONE 0 // No backup
47 #define BACKUP_HTTP 1 // HTTP(s) POST to a PHP script
48 #define BACKUP_CURL_SFTP 2 // SFTP via libcurl
39 49
40 50
41 // 51 //
42 // Custom SQL models 52 // Custom SQL models
43 // 53 //
176 186
177 void updateSortOrder(int index, Qt::SortOrder order); 187 void updateSortOrder(int index, Qt::SortOrder order);
178 188
179 void printDocument(QPrinter *printer); 189 void printDocument(QPrinter *printer);
180 190
181 void backupProgress(qint64 bytesSent, qint64 bytesTotal); 191 #ifdef USE_QTHTTP
182 void backupFinished(); 192 void httpBackupProgress(qint64 bytesSent, qint64 bytesTotal);
183 void backupError(QNetworkReply::NetworkError code); 193 void httpBackupFinished();
194 void httpBackupError(QNetworkReply::NetworkError code);
195 #endif
184 196
185 197
186 private: 198 private:
187 Ui::SyntilistaMainWindow *ui; 199 Ui::SyntilistaMainWindow *ui;
188 200
189 QProgressDialog *backupDialog; 201 QProgressDialog *backupDialog;
190 QNetworkReply *backupReply; 202 #ifdef USE_QTHTTP
203 QNetworkReply *httpBackupReply;
204 #endif
191 205
192 TransactionSQLModel *model_Latest; 206 TransactionSQLModel *model_Latest;
193 PersonInfo currPerson; 207 PersonInfo currPerson;
194 208
195 int peopleSortIndex; 209 int peopleSortIndex;