-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetamount.cpp
58 lines (46 loc) · 1.35 KB
/
getamount.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
#include "getamount.h"
#include "ui_getamount.h"
getAmount::getAmount(QWidget *parent,int _sell,int _buy,int _coin,int _tedad,int _capacity,int _kodom) :
QDialog(parent),
ui(new Ui::getAmount)
{
ui->setupUi(this);
sell=_sell;
buy=_buy;
coin=_coin;
tedad=_tedad;
capacity=_capacity;
kodom=_kodom;
ui->coin->setText(QString("coin ")+QString::number(_coin));
ui->tedad->setText(QString("tedad ")+QString::number(_tedad));
ui->BUY->setText(QString("BUY ")+QString::number(_buy));
ui->SELL->setText(QString("SELL ")+QString::number(_sell));
ui->capacity->setText(QString("Free Sapce ")+QString::number(_capacity));
}
getAmount::~getAmount()
{
delete ui;
}
void getAmount::on_SELL_clicked()
{
if(tedad-(ui->lineEdit->text().toInt())>=0){
emit mysell(kodom,ui->lineEdit->text().toInt());
}else {
QMessageBox::information(this,"ERROR","you dont have enough ");
}
this->close();
}
void getAmount::on_BUY_clicked()
{
if(coin-(ui->lineEdit->text().toInt()*buy)>=0){
if(capacity-(ui->lineEdit->text().toInt())>=0)
{
emit mybuy(kodom,ui->lineEdit->text().toInt());
}else {
QMessageBox::information(this,"ERROR","you dont have enough capacity");
}
}else {
QMessageBox::information(this,"ERROR","you dont have enough coin");
}
this->close();
}