Skip to content

Commit 5093103

Browse files
Update OOP Bugs Document and General Format Maintenance (#242)
1 parent 31ab8b8 commit 5093103

File tree

2 files changed

+67
-4
lines changed
  • kinks/level-5
    • cm-2005-object-oriented-programming
    • cm-2040-databases-networks-and-the-web

2 files changed

+67
-4
lines changed

kinks/level-5/cm-2005-object-oriented-programming/README.md

+65-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
[Go back to the main page](../../../README.md)
12

23
# Table of contents
34

45
- [Table of contents](#table-of-contents)
56
- [Object Oriented Programming - Reported Problems](#object-oriented-programming---reported-problems)
7+
- [Week 14](#week-14)
8+
- [7.5 Audio Playback - Files](#75-audio-playback---files)
9+
- [7.504 Adding a File Chooser](#7504-adding-a-file-chooser)
610
- [Week 18](#week-18)
711
- [9.2 Adding a moveable playhead](#92-adding-a-moveable-playhead)
812
- [9.207 - Implement A Timer](#9207-Implement-a-timer)
@@ -13,6 +17,48 @@
1317

1418
This page is about the [Object Oriented Programming module](../../../modules/level-5/cm-2005-object-oriented-programming/).
1519

20+
## Week 14
21+
22+
### 7.5 Audio Playback - Files
23+
24+
#### 7.504 Adding a File Chooser
25+
26+
_"For those of you wondering how to get the file browser working (chooser.browseForFileToOpen does not exist any more) without changing the library preprocessor symbols - use the async version, e.g. like this:"_ - Matthias Truxa
27+
28+
In `MainComponent.h` -> `private:`
29+
30+
```C++
31+
juce::FileChooser chooser{ "Select a file..." };
32+
```
33+
34+
In `MainComponent.cpp` -> `MainComponent::buttonClicked`
35+
36+
```C++
37+
void MainComponent::buttonClicked(Button* button)
38+
{
39+
if (button == &loadButton)
40+
{
41+
auto dlgFlags =
42+
juce::FileBrowserComponent::openMode |
43+
juce::FileBrowserComponent::canSelectFiles;
44+
45+
this->chooser.launchAsync(dlgFlags,
46+
[this](const juce::FileChooser& chooser)
47+
{
48+
player1.loadURL(chooser.getURLResult());
49+
});
50+
51+
// juce::FileChooser chooser{ "Select a file..." };
52+
// if (chooser.browseForFileToOpen())
53+
// {
54+
// player1.loadURL(URL{ chooser.getResult() });
55+
// }
56+
}
57+
}
58+
```
59+
60+
Note: There is another method where you can add `JUCE_MODAL_LOOPS_PERMITTED=1` to your JUCE preprocessors, but this method is not suggested as any changes you make to your preprocessor might not reflect in the graders' version. This might cause your project to not function as intended.
61+
1662
## Week 18
1763

1864
### 9.2 Adding a moveable playhead
@@ -21,7 +67,16 @@ This page is about the [Object Oriented Programming module](../../../modules/lev
2167

2268
_"There's a nasty bug in week 18 video 9.207. When you load a file the application will crash. After a bit of detective work it turns out that as the timer is being called before a file is loaded, the position is NaN (not a number). I found a simple fix for this: "_ - Jamie Jackson
2369

24-
![Solution](https://github.com/world-class/binary-assets/blob/master/modules/cm2005-oop/bugs/bug_9.207.png?raw=true)
70+
```C++
71+
void WaveformDisplay::setPositionRelative(double pos)
72+
{
73+
if (pos != position && !isnan(pos))
74+
{
75+
position = pos;
76+
repaint();
77+
}
78+
}
79+
```
2580
2681
## Week 19
2782
@@ -34,4 +89,12 @@ _"There's a nasty bug in week 18 video 9.207. When you load a file the applicati
3489
3590
_So a solution I came up with for the problem is to use getNumRows() and check if rowNum is less than it like in the image below._" - Jamie Jackson
3691
37-
![Solution](https://github.com/world-class/binary-assets/blob/master/modules/cm2005-oop/bugs/bug_10.107.png?raw=true)
92+
```C++
93+
void PlaylistComponent::paintCell(juce::Graphics& g, int rowNumber, int columnId, int width, int height, bool rowIsSelected)
94+
{
95+
if (rowNumber < getNumRows())
96+
{
97+
g.drawText(trackTitles[rowNumber], 2, 0, width -4, height, juce:Justification::centredleft, true);
98+
}
99+
}
100+
```

kinks/level-5/cm-2040-databases-networks-and-the-web/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[Go back to the main page](../../../README.md)
22

3-
### Table of contents
3+
# Table of contents
44

55
- [Unable to generate a link for the midterm](#unable-to-generate-a-link-for-the-midterm)
66

7-
---
7+
# Databases, Networks and the Web - Reported problems
88

99
## Unable to generate a link for the midterm
1010

0 commit comments

Comments
 (0)