-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
65 lines (61 loc) · 1.86 KB
/
mainwindow.cpp
File metadata and controls
65 lines (61 loc) · 1.86 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->vehi_found->hide();
ui->est_time_other->hide();
ui->identify->hide();
ui->notify->hide();
ui->soc_other->hide();
ui->logo_1->hide();
ui->logo_2->hide();
ui->square_1->hide();
ui->square_2->hide();
this->my_info = nullptr;
this->other_info = nullptr;
/* init classe reception de données */
QTimer::singleShot(200, this, SLOT(refresh_data()));
}
MainWindow::~MainWindow()
{
delete ui;
delete this->my_info;
if (this->other_info)
delete this->other_info;
}
void MainWindow::refresh_data()
{
if (!this->my_info)
this->my_info = new carInfo("ZoeGrise");
ui->soc->setText("" + QString::number(this->my_info->getSoc()) + "%");
ui->est_time->setText(""+ QString::number(this->my_info->getRemainingTime() / 60) + " h " + QString::number(this->my_info->getRemainingTime() % 60) + " min");
if (this->other_info)
{
ui->soc_other->setText("" + QString::number(this->other_info->getSoc()) + "%");
ui->est_time_other->setText(""+ QString::number(this->other_info->getRemainingTime() / 60) + " h " + QString::number(this->other_info->getRemainingTime() % 60) + " min");
}
/*set texte
* if (this->found)
* set texte other
*/
}
void MainWindow::on_search_button_clicked()
{
ui->search_button->setText("Recherche...");
ui->search_button->repaint();
this->other_info = new carInfo("ZoeBleue");
ui->search_button->hide();
ui->vehi_found->show();
ui->est_time_other->show();
ui->identify->show();
ui->notify->show();
ui->soc_other->show();
ui->logo_1->show();
ui->logo_2->show();
ui->square_1->show();
ui->square_2->show();
this->refresh_data();
}