-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.h
101 lines (74 loc) · 2.15 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QLineEdit>
#include <QHostAddress>
#include <QNetworkInterface>
#include <QTcpSocket>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlTableModel>
#include <QSql>
#include <QSqlError>
#include <QFile>
#include <QTextStream>
#include <QStringList>
#include <QMessageBox>
#include <QDateTime>
#include <QDebug>
#define SERVER_IP "192.168.1.5"
#define DB_USERNAME "citta"
#define DB_PASSWORD "attic"
#define DB_NAME "citta"
#define DATA_READY_MARK_DEL 1
#define DATA_READY_MARK_REUSE 2
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
QLineEdit *lineEditSearch;
QLineEdit *lineEditor;
QLineEdit *lineEditIP;
QSqlDatabase initDbHandle;
QSqlDatabase connDbHandle;
QSqlTableModel *maleModel;
QSqlTableModel *femaleModel;
int lastMaleCode;
int lastFemaleCode;
QString fahuiName;
QString editor;
QString globalReceipt;
QString localAddr;
QDateTime currentDatetime;
bool initDatabase(QString hostname, QString username, QString password);
bool connDatabase(QString hostname, QString username, QString password);
bool portTest(QString ip, int port);
bool getConfig();
bool isChinese(QString name);
bool setRowReuseStat(QString receipt);
void closeDatabase();
void refreshTableView(QString tableName, QString filter);
void clearLineEdits();
void initToolBarLineEdits();
void setQueryModel();
void viewPopMenu();
void getLocalAddr();
QString makeFname(QString name);
private slots:
void on_actionConnect_triggered();
void on_pushButtonSave_clicked();
void on_actionQuery_triggered();
void on_tableViewMale_customContextMenuRequested(const QPoint &pos);
void on_tableViewFemale_customContextMenuRequested(const QPoint &pos);
void on_actionSetResue_triggered();
void on_actionModify_triggered();
void receiveData(QString receipt, QString name, QString phone, QString pid, QString fname);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H