GCC Code Coverage Report


Directory: src/
File: src/mainView.cpp
Date: 2022-05-10 08:17:32
Exec Total Coverage
Lines: 55 55 100.0%
Functions: 10 10 100.0%
Branches: 18 32 56.2%

Line Branch Exec Source
1 #include "mainView.h"
2 #include "ui_mainView.h"
3
4 4 MainView::MainView(Controller &controller, interpreter::Manager &manager, QWidget *parent) :
5 QWidget(parent),
6 8 ui(new Ui::MainView),
7
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 debugTabWidget(new DebugTabWidget(manager, this)),
8 4 m_midiController(controller),
9 4 m_interpreterManager(manager),
10
2/4
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
4 m_currentTab(NOTSET)
11 {
12
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 ui->setupUi(this);
13
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 ui->tabWidget->addTab(debugTabWidget, tr("Debug"));
14
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 setMidiPorts();
15
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 tabWidgetCurrentChanged(static_cast<int>(TabIdentifier::DEBUG));
16
17
3/6
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
4 connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabWidgetCurrentChanged(int)));
18 4 }
19
20 16 MainView::~MainView()
21 {
22
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
8 delete debugTabWidget;
23
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
8 delete ui;
24 16 }
25
26 4 void MainView::setMidiPorts()
27 {
28 4 ui->midiInBox->addItems(m_midiController.getInputMidiPort());
29 4 ui->midiOutBox->addItems(m_midiController.getOutputMidiPort());
30
31 4 connect(ui->midiInBox, SIGNAL(currentIndexChanged(int)), &m_midiController, SLOT(activateInputMidiPort(int)));
32 4 connect(ui->midiOutBox, SIGNAL(currentIndexChanged(int)), &m_midiController, SLOT(activateOutputMidiPort(int)));
33
34 4 m_midiController.activateOutputMidiPort(0);
35 4 m_midiController.activateInputMidiPort(0);
36 4 }
37
38 4 QComboBox &MainView::getMidiInBox() const
39 {
40 4 return *(ui->midiInBox);
41 }
42
43 4 QComboBox &MainView::getMidiOutBox() const
44 {
45 4 return *(ui->midiOutBox);
46 }
47
48
49 1 Controller &MainView::getMidiController()
50 {
51 1 return m_midiController;
52 }
53
54 1 interpreter::Manager &MainView::getInterpretedManager()
55 {
56 1 return m_interpreterManager;
57 }
58
59 8 void MainView::tabWidgetCurrentChanged(int index)
60 {
61
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
8 switch (m_currentTab) {
62 4 case DEBUG:
63 4 deactivateDebugTab();
64 4 break;
65 4 default:
66 4 break;
67 }
68
69 8 m_currentTab = static_cast<TabIdentifier>(index);
70
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
8 switch (m_currentTab) {
71 4 case DEBUG:
72 4 activateDebugTab();
73 4 break;
74 4 default:
75 4 break;
76 }
77 8 }
78
79 4 void MainView::activateDebugTab()
80 {
81 4 connect(&m_midiController, SIGNAL(newMidiMessage(QByteArray)), debugTabWidget, SLOT(newMidiMessage(QByteArray)));
82 4 m_currentTab = DEBUG;
83 4 }
84
85 4 void MainView::deactivateDebugTab()
86 {
87 4 disconnect(&m_midiController, SIGNAL(newMidiMessage(QByteArray)), debugTabWidget, SLOT(newMidiMessage(QByteArray)));
88 4 m_currentTab = NOTSET;
89 4 }
90