-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrightstackwidget.cpp
More file actions
36 lines (29 loc) · 938 Bytes
/
rightstackwidget.cpp
File metadata and controls
36 lines (29 loc) · 938 Bytes
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
#include "rightstackwidget.h"
#include "currentdevicemanager.h"
RightStackWidget::RightStackWidget(QWidget *parent) : QStackedWidget(parent)
{
devicePage = new DevicePage(this);
this->addWidget(devicePage);
CurrentDeviceManager *cdm = CurrentDeviceManager::getInstance();
connect(cdm, &CurrentDeviceManager::currentDeviceChanged, this, &RightStackWidget::onCurrentDeviceChanged);
connect(cdm, &CurrentDeviceManager::deviceUnMounted, this, &RightStackWidget::onDeviceUnMounted);
}
RightStackWidget::~RightStackWidget()
{
}
void RightStackWidget::onCurrentDeviceChanged()
{
musicPage = new MusicPage(this);
filePage = new FilePage(this);
this->addWidget(musicPage);
this->addWidget(filePage);
}
void RightStackWidget::onDeviceUnMounted()
{
this->removeWidget(musicPage);
this->removeWidget(filePage);
if (this->count() > 1) {
delete musicPage;
delete filePage;
}
}