aboutsummaryrefslogtreecommitdiff
path: root/examples/tutorial_music_catalogue/main.cpp
blob: 5162946feb5cde4626b6150f7d69ec159ff5ab2b (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#include <MApplication>
#include <MApplicationWindow>

// The definition of our data classes
#include "data.h"

#include "mainpage.h"

void fillOutData(QList<Artist *> &artistList);

int main(int argc, char **argv)
{
    MApplication app(argc, argv);
    MApplicationWindow window;
    MainPage *mainPage;

    // That's the data that will be displayed by our application.
    // For the sake of keeping the example as simple as possible we use
    // a very simplistic data structure.
    QList<Artist *> artistsList;
    fillOutData(artistsList);

    mainPage = new MainPage(artistsList);

    mainPage->appear(&window);
    window.show();

    return app.exec();
}

void fillOutData(QList<Artist *> &artistList)
{
    Artist *artist;
    Album *album;

    artist = new Artist;
    artist->name = "The Beatles";

    album = new Album;
    album->title = "Sgt. Pepper's Lonely Hearts Club Band";
    album->artist = "The Beatles";
    album->coverArtFilename = "album_cover.jpg";
    album->songs << "Sgt. Pepper's Lonely Hearts Club Band";
    album->songs << "With a Little Help from My Friends";
    album->songs << "Lucy in the Sky with Diamonds";
    album->songs << "Getting Better";
    album->songs << "Fixing a Hole";
    album->songs << "She's Leaving Home";
    album->songs << "Being for the Benefit of Mr. Kite!";
    artist->albums << album;

    album = new Album;
    album->title = "Yellow Submarine";
    album->artist = "The Beatles";
    album->coverArtFilename = "album_cover.jpg";
    album->songs << "Yellow Submarine";
    album->songs << "Only a Northern Song";
    album->songs << "All Together Now";
    album->songs << "Hey Bulldog";
    album->songs << "It's All Too Much";
    album->songs << "All You Need Is Love";
    artist->albums << album;

    album = new Album;
    album->title = "Abbey Road";
    album->artist = "The Beatles";
    album->coverArtFilename = "album_cover.jpg";
    album->songs << "Come Together";
    album->songs << "Something";
    album->songs << "Maxwell's Silver Hammer";
    album->songs << "Oh! Darling";
    album->songs << "Octopus's Garden";
    album->songs << "I Want You (She's So Heavy)";
    artist->albums << album;

    artistList << artist;



    artist = new Artist;
    artist->name = "Led Zeppelin";

    album = new Album;
    album->title = "Physical Graffiti";
    album->artist = "Led Zeppelin";
    album->coverArtFilename = "album_cover.jpg";
    album->songs << "Custard Pie";
    album->songs << "The Rover";
    album->songs << "In My Time of Dying";
    album->songs << "Houses of the Holy";
    album->songs << "Trampled Under Foot";
    album->songs << "Kashmir";
    artist->albums << album;

    album = new Album;
    album->title = "Houses of the Holy";
    album->artist = "Led Zeppelin";
    album->coverArtFilename = "album_cover.jpg";
    album->songs << "The Song Remains the Same";
    album->songs << "The Rain Song";
    album->songs << "Over the Hills and Far Away";
    album->songs << "The Crunge";
    album->songs << "Dancing Days";
    album->songs << "D'yer Mak'er";
    album->songs << "No Quarter";
    album->songs << "The Ocean";
    artist->albums << album;

    album = new Album;
    album->title = "Presence";
    album->artist = "Led Zeppelin";
    album->coverArtFilename = "album_cover.jpg";
    album->songs << "Achilles Last Stand";
    album->songs << "For Your Life";
    album->songs << "Royal Orleans";
    album->songs << "Nobody's Fault but Mine";
    album->songs << "Candy Store Rock";
    album->songs << "Hots On for Nowhere";
    album->songs << "Tea for One";
    artist->albums << album;

    artistList << artist;
}