-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.cpp
106 lines (73 loc) · 3.17 KB
/
mainwindow.cpp
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
102
103
104
105
#include "mainwindow.h"
#include "./ui_mainwindow.h"
#include "info/exchangeinfo.h"
#include "main/viewport.h"
#include "info/exchangemodel.h"
#include "session/sessionmanager.h"
#include <QUrl>
#include <QThread>
#include "binance/restapi/restapi.h"
#include "global/alarmwidget.h"
#include "binance/kline.h"
#include "series/seri.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setWindowTitle("BBOverFloaw");
Binance::Public::RestAPI::RestAPI::instance();
// qDebug() << "Size:: "<<Binance::Public::RestAPI::RestAPI::instance()->symbolList().size();
// auto symbol = Binance::Public::RestAPI::RestAPI::instance()->symbolList().first();
// qDebug() << symbol << "";
// auto list = Binance::Public::RestAPI::RestAPI::instance()->getCandles("BTCUSDT","1d",50);
// qDebug() << "Thread Worked" << list.size();
///////////////////////////
mExchangeInfo = new ExchangeInfo::ExchangeInfo();
ui->exchangeVLayout->addWidget(mExchangeInfo);
mViewPort = new Main::ViewPort();
// mViewPort->setDragMode(QGraphicsView::ScrollHandDrag);
ui->verticalGraphLayout->addWidget(mViewPort);
QObject::connect(mExchangeInfo,&ExchangeInfo::ExchangeInfo::selectedPair,[=, this](const QString mPairName){
mViewPort->addItem(mPairName);
});
QObject::connect(ui->actionSound_Test,&QAction::triggered,[=, this](){
qDebug() << ui->actionSound_Test->text();
});
QObject::connect(ui->actionSave_As,&QAction::triggered,[=]( const bool &val){
Session::SessionManager::instance()->saveDialog();
});
QObject::connect(ui->actionLoad,&QAction::triggered,[=, this]( const bool &val){
if( Session::SessionManager::instance()->openSessionDialog() ){
QTimer* mTimer = new QTimer();
int count = 0;
QObject::connect(mTimer,&QTimer::timeout,[=, this]()mutable{
if( count < Session::SessionManager::instance()->pairListSize() ){
mViewPort->addItem(Session::SessionManager::instance()->pairName(count));
mExchangeInfo->append(Session::SessionManager::instance()->pairName(count++));
if( count >= Session::SessionManager::instance()->pairListSize() ){
mTimer->stop();
}
}else{
mTimer->stop();
mTimer->deleteLater();
}
});
mTimer->start(500);
// for( int i = 0 ; i < Session::SessionManager::instance()->pairListSize() ; i++ ){
// QThread::currentThread()->wait(500);
// mViewPort->setPairItem(Session::SessionManager::instance()->pairName(i));
// mExchangeInfo->append(Session::SessionManager::instance()->pairName(i));
// }
mExchangeInfo->update();
}
});
QObject::connect(ui->actionSound_Test,&QAction::triggered,[=](){
Global::Alarm::AlarmWidget::instance()->popUpMessage("Test");
});
// Binance::Public::Future::RestAPI::instance()->exchangeInfo();
}
MainWindow::~MainWindow()
{
delete ui;
}