forked from donaloconnor/automon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cardetailswidget.cpp
62 lines (52 loc) · 3.27 KB
/
cardetailswidget.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
/*
==================================================================================================
| cardetailswidget.cpp |
| Part of the Automon application. |
| |
| Final Year Project - "An Embedded Automotive Monitoring Device" |
| |
| By Donal O' Connor for completion of B.Sc (Hons) Software Development and Computer Networking |
| Email: [email protected] |
| Website/Blog: http://automon.killarneyonline.eu |
| |
| Cork Institute of Technology, Cork, Ireland - http://www.cit.ie/ |
| |
| Copyright © 2009 Donal O'Connor <[email protected]> |
==================================================================================================
The implementation file of the CarDetailsWidget. Further details below
*/
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "cardetailswidget.h"
CarDetailsWidget::CarDetailsWidget(Automon * kernel, QWidget * parent)
: QWidget(parent), m_kernel(kernel)
{
/* Create Layouts */
m_mainLayout = new QHBoxLayout(this);
m_verticalLayout = new QVBoxLayout();
/* Create the labels that the user will see, including the tr() function for easy translation in future */
m_header = new QLabel(tr("Car Details"));
QLabel * carVin = new QLabel(tr("<strong>Vehicle ID:</strong> ") + kernel->getVin());
QLabel * obdStandard = new QLabel(tr("<strong>Car's OBD Standard:</strong> ") + kernel->getOBDStandardType());
QLabel * obdProtocol = new QLabel(tr("<strong>Car's OBD Protocol:</strong> ") + kernel->getOBDProtocol());
QLabel * elmVersion = new QLabel(tr("<strong>ELM Interface Version:</strong> ") + kernel->getElmVersion());
QLabel * voltage = new QLabel(tr("<strong>Current Battery Voltage:</strong> ") + kernel->getVoltage());
QLabel * introduction = new QLabel(tr("This widget displays some very simple car details."));
/* Set style of header */
m_header->setStyleSheet("color: #ace413; font-size:25px");
/* Organise layouts and add widgets to layouts */
m_mainLayout->addLayout(m_verticalLayout);
m_verticalLayout->addWidget(m_header);
m_verticalLayout->addWidget(introduction);
m_verticalLayout->addSpacing(10);
m_verticalLayout->addWidget(carVin);
m_verticalLayout->addWidget(obdStandard);
m_verticalLayout->addWidget(obdProtocol);
m_verticalLayout->addWidget(elmVersion);
m_verticalLayout->addWidget(voltage);
m_verticalLayout->setAlignment(Qt::AlignTop);
m_mainLayout->setAlignment(Qt::AlignTop);
/* Set the main layout */
setLayout(m_mainLayout);
}