-
Notifications
You must be signed in to change notification settings - Fork 2
/
drivewidget.cpp
47 lines (35 loc) · 1.2 KB
/
drivewidget.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
#include "drivewidget.h"
#include <QHBoxLayout>
#include <QDebug>
DriveWidget::DriveWidget(Drive *srcdrive)
{
drive = srcdrive;
mountPointLabel = new QLabel(*(new QString(drive->getMountPoint())));
mountPointLabel->setObjectName("mount-point-label");
productLabel = new QLabel(QString(drive->getProduct()));
productLabel->setObjectName("product-label");
ejectDriveButton = new QPushButton("Eject");
ejectDriveButton->setObjectName("eject-button");
connect(ejectDriveButton, &QPushButton::clicked, this, &DriveWidget::sendEjectSignal);
QHBoxLayout *rootLayout = new QHBoxLayout;
rootLayout->setContentsMargins(0, 0, 0, 0);
rootLayout->setSpacing(0);
rootLayout->addWidget(mountPointLabel);
rootLayout->addWidget(productLabel);
rootLayout->addSpacerItem(new QSpacerItem(10, 0, QSizePolicy::Expanding, QSizePolicy::Fixed));
rootLayout->addWidget(ejectDriveButton);
rootLayout->setAlignment(Qt::AlignLeft);
setLayout(rootLayout);
}
Drive *DriveWidget::getDrive() const
{
return drive;
}
void DriveWidget::setDrive(Drive *value)
{
drive = value;
}
void DriveWidget::sendEjectSignal()
{
emit ejectDriveButtonPressed(drive->getMountPoint());
}