-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
100 lines (77 loc) · 2.36 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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QRadioButton>
#include <QCheckBox>
#include <QtSql>
#include <QMessageBox>
#include <QTableWidget>
#include "usersetting.h"
#include <QSettings>
#include <QSqlQueryModel>
#include <QItemSelectionModel>
#include <QSortFilterProxyModel>
//#include "login.h"
namespace Ui {
class MainWindow;
}
//TODO: recreate tableView's
class MainWindow : public QMainWindow
{
Q_OBJECT
QSqlQueryModel* booksModel;
QItemSelectionModel* booksItem;
QSortFilterProxyModel* booksProxyModel;
QSqlQueryModel* bundlesModel;
QItemSelectionModel* bundlesItem;
QSqlQueryModel* cartModel;
QItemSelectionModel* cartItem;
QSqlQueryModel* historyModel;
QItemSelectionModel* historyItem;
QString databaseDriver;
QString databaseHost;
QString databaseName;
QString databaseUser;
QString databasePassword;
unsigned databasePort;
void populate_books();
void add_book_to_cart(int row_index);
void add_bundle_to_cart(int row_index);
void delete_book_from_cart(int row_index);
void clear_Cart();
int current_customer_ID;
int current_book_page;
int max_book_pages;
public:
void update_tableView_Books();
void update_tableView_Bundles();
void update_tableView_Cart();
void update_tableView_History();
void update_wallet();
void setCurrent_customer_ID(int ID) {current_customer_ID = ID;}
int getCurrent_customer_ID() {return current_customer_ID;}
explicit MainWindow(QWidget *parent = 0);
bool openDB();
void closeDB();
void dbget_Book();
void setUsername(QString usern);
void login_dialog();
~MainWindow();
public slots:
// void clicked_tableWidget3_row_delete(int x, int y);
private slots:
void on_pushButton_clicked(); //search
void on_pushButton_3_clicked(); //purchase
void on_pushButton_2_clicked(); //clear cart
void on_pushButton_account_clicked();
void on_tableView_Books_clicked(const QModelIndex &index);
void on_tableView_Cart_clicked(const QModelIndex &index);
void on_tableView_Bundles_clicked(const QModelIndex &index);
void on_pushButton_Prev_clicked();
void on_pushButton_Next_clicked();
void on_tableView_Bundles_doubleClicked(const QModelIndex &index);
private:
Ui::MainWindow *ui;
QString username;
};
#endif // MAINWINDOW_H