-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmain_window.cpp
More file actions
75 lines (49 loc) · 2.43 KB
/
main_window.cpp
File metadata and controls
75 lines (49 loc) · 2.43 KB
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
#include "main_window.h"
#include "./ui_main_window.h"
#include "asos_root/logger_page.h"
#include "asos_root/history_page.h"
#include "asos_root/fake_account_page.h"
#include "asos_root/binance_account_page.h"
#define DEFAULT_SELECTED_COIN coin_select_e::BTC
main_window::main_window(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::main_window)
{
ui->setupUi(this);
/***************/
binance_web_socket_c* web_socket = new binance_web_socket_c(this , DEFAULT_SELECTED_COIN);
binance_rest_api_c* rest_api = new binance_rest_api_c(this , DEFAULT_SELECTED_COIN);
/***************/
QVBoxLayout *layout = new QVBoxLayout(this);
QHBoxLayout *_layout = new QHBoxLayout(this);
logger_page_c * logger_page = new logger_page_c(this );
binance_account_page_c* account_page = new binance_account_page_c(this,DEFAULT_SELECTED_COIN,web_socket,rest_api);
history_page_c* history_page = new history_page_c(this,DEFAULT_SELECTED_COIN,web_socket,rest_api);
fake_account_page_c* fake_page = new fake_account_page_c(this,DEFAULT_SELECTED_COIN,web_socket,rest_api);
QTabWidget * tab_widget_controls = new QTabWidget(this);
tab_widget_controls->addTab(fake_page, "fake account test");
tab_widget_controls->addTab(account_page, "binance account");
tab_widget_controls->addTab(history_page, "history test");
_layout->addWidget(tab_widget_controls , 3);
_layout->addWidget(logger_page , 1);
layout->addLayout(_layout);
setWindowTitle("ASOS BOT");
QWidget *centralWidget = new QWidget(this);
centralWidget->setLayout(layout);
setCentralWidget(centralWidget);
QIcon icon(":photos/icon3.png");
if(!icon.isNull())
setWindowIcon(icon);
QObject::connect(rest_api, &binance_rest_api_c::user_data_stream_finded,
this, [this,web_socket](const QString& listen_key) {
web_socket->user_stream_web_socket_start(listen_key);
});
QObject::connect(account_page, &binance_account_page_c::log_print, logger_page, &logger_page_c::log_print);
QObject::connect(history_page, &history_page_c::log_print, logger_page, &logger_page_c::log_print);
QObject::connect(web_socket, &binance_web_socket_c::log_print,logger_page, &logger_page_c::log_print);
QObject::connect(rest_api, &binance_rest_api_c::log_print,logger_page, &logger_page_c::log_print);
}
main_window::~main_window()
{
delete ui;
}