-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_window.cpp
More file actions
72 lines (61 loc) · 1.76 KB
/
main_window.cpp
File metadata and controls
72 lines (61 loc) · 1.76 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
66
67
68
69
70
71
72
/**
* @file main_window.cpp
* @brief ${DESCRIPTION}
*
* @author Arindam
* @date 11/11/2024
*/
// You may need to build the project (run Qt uic code generator) to get "ui_main_window.h" resolved
#include <QGridLayout>
#include <QStyle>
#include <QDebug>
#include "main_window.hpp"
#include "ui_main_window.h"
#include "audio_panel.hpp"
#include "control_panel.hpp"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
// Initialize member variables
layout = new QGridLayout(nullptr);
panel1 = new AudioPanel(this);
panel2 = new AudioPanel(this);
panel3 = new AudioPanel(this);
panel4 = new AudioPanel(this);
control_panel = new ControlPanel(this);
// Connect signals from control_panel
connect(control_panel->get_button_play(), &QPushButton::clicked, this, &MainWindow::control_play);
connect(control_panel->get_button_pause(), &QPushButton::clicked, this, &MainWindow::control_pause);
connect(control_panel->get_button_stop(), &QPushButton::clicked, this, &MainWindow::control_stop);
// Set layout
layout->addWidget(panel1, 0, 0);
layout->addWidget(panel2, 0, 1);
layout->addWidget(panel3, 1, 0);
layout->addWidget(panel4, 1, 1);
layout->addWidget(control_panel, 2, 0, 1, 2);
adjustSize();
ui->centralwidget->setLayout(layout);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::control_play()
{
for (auto &panel: {panel1, panel2, panel3, panel4}) {
panel->play();
}
}
void MainWindow::control_pause()
{
for (auto &panel: {panel1, panel2, panel3, panel4}) {
panel->pause();
}
}
void MainWindow::control_stop()
{
for (auto &panel: {panel1, panel2, panel3, panel4}) {
panel->stop();
}
}