Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "debugtabwidget.h" | ||
2 | #include "ui_debugtabwidget.h" | ||
3 | |||
4 | #include "mainView.h" | ||
5 | #include "interpreter/exceptions.h" | ||
6 | |||
7 | 7 | DebugTabWidget::DebugTabWidget(interpreter::Manager &manager, QWidget *parent) : | |
8 | QWidget(parent), | ||
9 | 14 | ui(new Ui::DebugTabWidget), | |
10 | 7 | m_manager(manager), | |
11 |
2/4✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
|
7 | m_current_interpreter(nullptr) |
12 | { | ||
13 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | ui->setupUi(this); |
14 |
3/6✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
|
7 | connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(onClearButtonClicked())); |
15 |
3/6✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
|
7 | connect(ui->interpretedSelector, SIGNAL(currentTextChanged(const QString &)), this, SLOT(onInterpretedSelectorChanged(const QString &))); |
16 | |||
17 |
3/6✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
|
7 | ui->interpretedSelector->addItems(m_manager.getInterpreterList().keys()); |
18 | 7 | } | |
19 | |||
20 | 28 | DebugTabWidget::~DebugTabWidget() | |
21 | { | ||
22 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
14 | delete ui; |
23 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 4 times.
|
14 | delete m_current_interpreter; |
24 | 28 | } | |
25 | |||
26 | 3 | void DebugTabWidget::newMidiMessage(QByteArray message) | |
27 | { | ||
28 | 3 | QString new_message_string; | |
29 |
4/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 27 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 24 times.
✓ Branch 7 taken 3 times.
|
27 | for (auto it = message.begin(); it != message.end(); ++it) { |
30 |
3/6✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 24 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 24 times.
✗ Branch 9 not taken.
|
24 | new_message_string.append(QString("%1 ").arg(static_cast<unsigned int>(*it) & 0xff, 2, 16, QChar('0'))); |
31 | } | ||
32 | |||
33 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | ui->debugContentEdit->append(new_message_string); |
34 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if (m_current_interpreter != nullptr) { |
35 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | QString interpreted = m_current_interpreter->stringFromMidiMessage(message); |
36 |
3/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 3 times.
✗ Branch 10 not taken.
|
3 | ui->interpretedCommandList->append(QString("%1").arg(interpreted)); |
37 | 3 | } | |
38 | 3 | } | |
39 | |||
40 | 1 | void DebugTabWidget::onClearButtonClicked() | |
41 | { | ||
42 | 1 | ui->debugContentEdit->clear(); | |
43 | 1 | } | |
44 | |||
45 | 3 | void DebugTabWidget::onInterpretedSelectorChanged(const QString &interpreter) | |
46 | { | ||
47 |
1/2✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | m_current_interpreter = m_manager.getInterpreterList().find(interpreter).value()(); |
48 | 3 | } | |
49 | |||
50 | 2 | QTextEdit *DebugTabWidget::getRawOutput() | |
51 | { | ||
52 | 2 | return ui->debugContentEdit; | |
53 | } | ||
54 | |||
55 | 1 | QTextEdit *DebugTabWidget::getInterpretedOutput() | |
56 | { | ||
57 | 1 | return ui->interpretedCommandList; | |
58 | } | ||
59 | |||
60 | 1 | QPushButton *DebugTabWidget::getClearButton() | |
61 | { | ||
62 | 1 | return ui->clearButton; | |
63 | } | ||
64 | |||
65 | 1 | QComboBox &DebugTabWidget::getInterpreterSelector() | |
66 | { | ||
67 | 1 | return *ui->interpretedSelector; | |
68 | } | ||
69 |