Skip to content

Commit

Permalink
Rename group to artist
Browse files Browse the repository at this point in the history
  • Loading branch information
Iktwo committed Sep 22, 2014
1 parent 1cdafe6 commit cbe1c13
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 46 deletions.
6 changes: 3 additions & 3 deletions qml/FakeMainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ Item {
id: fakeModel

ListElement {
name: "Arrullo De Estrellas"; group: "Zoé"
name: "Arrullo De Estrellas"; artist: "Zoé"
length: "4:14"; comment: "Bonita canción que me hace pensar en ti.."
code: ""; url: "xxx"
}

ListElement {
name: "Goodbye Lovers and Friends"; group: "Franz Ferdinand"
name: "Goodbye Lovers and Friends"; artist: "Franz Ferdinand"
length: "4:34"; comment: "I love this song!"
code: ""; url: "xxx"
}

ListElement {
name: "Addicted to you"; group: "Avicii"
name: "Addicted to you"; artist: "Avicii"
length: "3:24"; comment: "I am addicted to you"
code: ""; url: "xxx"
}
Expand Down
8 changes: 4 additions & 4 deletions qml/MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Page {

onRequestedPlay: {
if (playlist.count >= index) {
playbackControls.song = playlist.get(index).name + " - <i>" + playlist.get(index).group + "</i>"
playbackControls.song = playlist.get(index).name + " - <i>" + playlist.get(index).artist + "</i>"
audioElement.source = model.url
audioElement.index = index
audioElement.play()
Expand All @@ -92,12 +92,12 @@ Page {

if (index < playlist.count - 1) {
/// Will copy next item data, no need to change index
playbackControls.song = playlist.get(index + 1).name + " - <i>" + playlist.get(index + 1).group + "</i>"
playbackControls.song = playlist.get(index + 1).name + " - <i>" + playlist.get(index + 1).artist + "</i>"
audioElement.source = playlist.get(index + 1).url
audioElement.play()
} else if (index - 1 >= 0) {
/// Will copy previous item data, update index to -1
playbackControls.song = playlist.get(index - 1).name + " - <i>" + playlist.get(index - 1).group + "</i>"
playbackControls.song = playlist.get(index - 1).name + " - <i>" + playlist.get(index - 1).artist + "</i>"
audioElement.source = playlist.get(index - 1).url
audioElement.index = audioElement.index - 1
audioElement.play()
Expand All @@ -117,6 +117,6 @@ Page {
}

//Component.onCompleted: playlist.append({"name" : "First Song",
//"group" : "First Group", "length" : "3:31", "comment" : "this is a test",
//"artist" : "First Group", "length" : "3:31", "comment" : "this is a test",
//"code" : "XASDDASD", "url": "invalid", "picture": "crazytest"})
}
2 changes: 1 addition & 1 deletion qml/SearchPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Page {
}

playlist.append({ "name" : model.name,
"group" : model.group,
"artist" : model.artist,
"length" : model.length,
"comment" : model.comment,
"code" : model.code,
Expand Down
2 changes: 1 addition & 1 deletion qml/SongDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Item {
Layout.fillWidth: true
color: Style.TEXT_COLOR_DARK
elide: Text.ElideRight
text: model.name + " - <i>" + model.group + "</i>"
text: model.name + " - <i>" + model.artist + "</i>"
renderType: Text.NativeRendering
maximumLineCount: 1
}
Expand Down
6 changes: 3 additions & 3 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ApplicationWindow {
else
audio.index = 0

playbackControls.song = playlist.get(audio.index).name + " - <i>" + playlist.get(audio.index).group + "</i>"
playbackControls.song = playlist.get(audio.index).name + " - <i>" + playlist.get(audio.index).artist + "</i>"
audio.source = playlist.get(audio.index).url
audio.play()
}
Expand All @@ -40,7 +40,7 @@ ApplicationWindow {
else
audio.index = playlist.count - 1

playbackControls.song = playlist.get(audio.index).name + " - <i>" + playlist.get(audio.index).group + "</i>"
playbackControls.song = playlist.get(audio.index).name + " - <i>" + playlist.get(audio.index).artist + "</i>"
audio.source = playlist.get(audio.index).url
audio.play()
}
Expand Down Expand Up @@ -107,7 +107,7 @@ ApplicationWindow {
onRowsInserted: {
// If new item is first on list, play it
if (count === 1) {
playbackControls.song = playlist.get(audio.index).name + " - <i>" + playlist.get(audio.index).group + "</i>"
playbackControls.song = playlist.get(audio.index).name + " - <i>" + playlist.get(audio.index).artist + "</i>"
audio.source = playlist.get(audio.index).url
audio.play()
} else if (audio.status == Audio.EndOfMedia) {
Expand Down
12 changes: 6 additions & 6 deletions qml/testModels/TestSearchModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ListModel {
id: testModel
ListElement {
name: "Labios Rotos"
group: "Zoe"
artist: "Zoe"
picture: "zoe"
length: "3:40"
comment: "Bonita canción"
Expand All @@ -13,7 +13,7 @@ ListModel {
}
ListElement {
name: "Yesterday"
group: "The Beatles"
artist: "The Beatles"
picture: "beatles"
length: "2:58"
comment: "The yellow submarine!"
Expand All @@ -22,7 +22,7 @@ ListModel {
}
ListElement {
name: "Another one bites the dust"
group: "Queen"
artist: "Queen"
picture: "queen"
length: "3:14"
comment: "We are the champions my friend!"
Expand All @@ -31,7 +31,7 @@ ListModel {
}
ListElement {
name: "hips don't lie"
group: "Shakira"
artist: "Shakira"
picture: "shakira"
length: "3:22"
comment: "Waka waka!"
Expand All @@ -40,7 +40,7 @@ ListModel {
}
ListElement {
name: "Hotel Room Service"
group: "Pitbull"
artist: "Pitbull"
picture: "pitbull"
length: "4:15"
comment: "Ya tu sabe!"
Expand All @@ -49,7 +49,7 @@ ListModel {
}
ListElement {
name: "Song Name"
group: "Fake"
artist: "Fake"
picture: "crazystuff"
length: "3:10"
comment: "This a long useful comment"
Expand Down
12 changes: 6 additions & 6 deletions src/downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ void Downloader::downloadFinished(QNetworkReply *reply)
termEnds = songs.indexOf(closingTerm, termBegins);

QString tmp = songs.mid(termBegins, termEnds - termBegins);
QString group = tmp.mid(0, tmp.indexOf(" -"));
QString title = tmp.mid(tmp.indexOf("- ") + 2);
QString artist = tmp.mid(0, tmp.indexOf(" -"));
QString title = tmp.mid(tmp.indexOf("- ") + 1);

if (group == "")
group = tmp;
if (artist == "")
artist = tmp;

if (title == "")
title = tmp;
Expand Down Expand Up @@ -256,13 +256,13 @@ void Downloader::downloadFinished(QNetworkReply *reply)
comment = comment.mid(termBegins, termEnds - termBegins);

// qDebug() << "ADDDING SONG:";
// qDebug() << "TITLE:" << title << "GROUP:" << group << "LENGTH:" << length
// qDebug() << "TITLE:" << title << "ARTIST:" << artist << "LENGTH:" << length
// << "COMMENT:" << comment << "KBPS:" << kbps << "CODE:" << code
// << "PICTURE:" << picture;

songs = songs.mid(songs.indexOf("<li class=\"group board_item item_pict sound_item\">"));

emit songFound(title, group, length, comment, kbps.toInt(), code, picture, hits.replace(",", "").toLong());
emit songFound(title, artist, length, comment, kbps.toInt(), code, picture, hits.replace(",", "").toLong());
getDownloadLink(code);
}
} else if (mimeType == "audio/mpeg") {
Expand Down
2 changes: 1 addition & 1 deletion src/downloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public slots:
void downloadFinished(QNetworkReply *reply);

signals:
void songFound(const QString &title, const QString &group, const QString &length,
void songFound(const QString &title, const QString &artist, const QString &length,
const QString &comment, int kbps, const QString &code,
const QString &picture, long long hits);

Expand Down
10 changes: 5 additions & 5 deletions src/musicstreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ void MusicStreamer::search(const QString &term)
mDownloader->search(searchTerm.replace(" ", "-"));
}

void MusicStreamer::songFound(const QString &title, const QString &group, const QString &length,
void MusicStreamer::songFound(const QString &title, const QString &artist, const QString &length,
const QString &comment, int kbps, const QString &code,
const QString &picture, long long hits)
{
beginInsertRows(QModelIndex(), rowCount(), rowCount());
mSongs.append(new Song(title, group, length, comment, kbps, code, picture, hits, this));
mSongs.append(new Song(title, artist, length, comment, kbps, code, picture, hits, this));
endInsertRows();

emit songsChanged();
Expand Down Expand Up @@ -92,8 +92,8 @@ QVariant MusicStreamer::data(const QModelIndex & index, int role) const
Song *song = qobject_cast<Song*>(mSongs[index.row()]);
if (role == NameRole)
return song->name();
else if (role == GroupRole)
return song->group();
else if (role == ArtistRole)
return song->artist();
else if (role == LengthRole)
return song->length();
else if (role == CommentRole)
Expand Down Expand Up @@ -121,7 +121,7 @@ QHash<int, QByteArray> MusicStreamer::roleNames() const
{
QHash<int, QByteArray> roles;
roles[NameRole] = "name";
roles[GroupRole] = "group";
roles[ArtistRole] = "artist";
roles[LengthRole] = "length";
roles[CommentRole] = "comment";
roles[KbpsRole] = "kbps";
Expand Down
4 changes: 2 additions & 2 deletions src/musicstreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MusicStreamer : public QAbstractListModel
public:
enum DownloaderRoles {
NameRole = Qt::UserRole + 1,
GroupRole,
ArtistRole,
LengthRole,
CommentRole,
KbpsRole,
Expand Down Expand Up @@ -68,7 +68,7 @@ class MusicStreamer : public QAbstractListModel
int fetched;

private slots:
void songFound(const QString &title, const QString &group, const QString &length,
void songFound(const QString &title, const QString &artist, const QString &length,
const QString &comment, int kbps, const QString &code,
const QString &picture, long long hits);
void decodedUrl(const QString &code, const QString &url);
Expand Down
16 changes: 8 additions & 8 deletions src/song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Song::Song(QObject *parent)
{
}

Song::Song(const QString &name, const QString &group, const QString &length,
Song::Song(const QString &name, const QString &artist, const QString &length,
const QString &comment, int kbps, const QString &code, const QString &picture,
long long hits, QObject *parent)
: QObject(parent),
m_name(name),
m_group(group),
m_artist(artist),
m_length(length),
m_comment(comment),
m_kbps(kbps),
Expand All @@ -35,18 +35,18 @@ void Song::setName(const QString &name)
emit nameChanged();
}

QString Song::group() const
QString Song::artist() const
{
return m_group;
return m_artist;
}

void Song::setGroup(const QString &group)
void Song::setArtist(const QString &artist)
{
if (m_group == group)
if (m_artist == artist)
return;

m_group = group;
emit groupChanged();
m_artist = artist;
emit artistChanged();
}

QString Song::length() const
Expand Down
12 changes: 6 additions & 6 deletions src/song.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Song : public QObject

Q_PROPERTY(QString name READ name NOTIFY nameChanged)

Q_PROPERTY(QString group READ group NOTIFY groupChanged)
Q_PROPERTY(QString artist READ artist NOTIFY artistChanged)
Q_PROPERTY(QString length READ length NOTIFY lengthChanged)
Q_PROPERTY(QString comment READ comment NOTIFY commentChanged)
Q_PROPERTY(QString code READ code NOTIFY codeChanged)
Expand All @@ -21,19 +21,19 @@ class Song : public QObject
public:
Song(QObject *parent = 0);

Song(const QString &name, const QString &group, const QString &length, const QString &comment,
Song(const QString &name, const QString &artist, const QString &length, const QString &comment,
int kbps, const QString &code, const QString &picture, long long hits, QObject *parent = 0);

QString name() const;
QString group() const;
QString artist() const;
QString length() const;
QString comment() const;
int kbps() const;
QString code() const;
QString url() const;

void setName(const QString &name);
void setGroup(const QString &group);
void setArtist(const QString &artist);
void setLength(const QString &length);
void setComment(const QString &comment);
void setCode(const QString &code);
Expand All @@ -48,7 +48,7 @@ class Song : public QObject

signals:
void nameChanged();
void groupChanged();
void artistChanged();
void lengthChanged();
void commentChanged();
void codeChanged();
Expand All @@ -59,7 +59,7 @@ class Song : public QObject

private:
QString m_name;
QString m_group;
QString m_artist;
QString m_length;
QString m_comment;
int m_kbps;
Expand Down

0 comments on commit cbe1c13

Please sign in to comment.