diff --git a/qml/FakeMainPage.qml b/qml/FakeMainPage.qml index 74d705d..b27b4df 100644 --- a/qml/FakeMainPage.qml +++ b/qml/FakeMainPage.qml @@ -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" } diff --git a/qml/MainPage.qml b/qml/MainPage.qml index 9950c16..8df1ccc 100644 --- a/qml/MainPage.qml +++ b/qml/MainPage.qml @@ -77,7 +77,7 @@ Page { onRequestedPlay: { if (playlist.count >= index) { - playbackControls.song = playlist.get(index).name + " - " + playlist.get(index).group + "" + playbackControls.song = playlist.get(index).name + " - " + playlist.get(index).artist + "" audioElement.source = model.url audioElement.index = index audioElement.play() @@ -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 + " - " + playlist.get(index + 1).group + "" + playbackControls.song = playlist.get(index + 1).name + " - " + playlist.get(index + 1).artist + "" 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 + " - " + playlist.get(index - 1).group + "" + playbackControls.song = playlist.get(index - 1).name + " - " + playlist.get(index - 1).artist + "" audioElement.source = playlist.get(index - 1).url audioElement.index = audioElement.index - 1 audioElement.play() @@ -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"}) } diff --git a/qml/SearchPage.qml b/qml/SearchPage.qml index 824567a..59076cd 100644 --- a/qml/SearchPage.qml +++ b/qml/SearchPage.qml @@ -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, diff --git a/qml/SongDelegate.qml b/qml/SongDelegate.qml index 915ee2d..d00fa87 100644 --- a/qml/SongDelegate.qml +++ b/qml/SongDelegate.qml @@ -71,7 +71,7 @@ Item { Layout.fillWidth: true color: Style.TEXT_COLOR_DARK elide: Text.ElideRight - text: model.name + " - " + model.group + "" + text: model.name + " - " + model.artist + "" renderType: Text.NativeRendering maximumLineCount: 1 } diff --git a/qml/main.qml b/qml/main.qml index 55a77b8..dc70009 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -29,7 +29,7 @@ ApplicationWindow { else audio.index = 0 - playbackControls.song = playlist.get(audio.index).name + " - " + playlist.get(audio.index).group + "" + playbackControls.song = playlist.get(audio.index).name + " - " + playlist.get(audio.index).artist + "" audio.source = playlist.get(audio.index).url audio.play() } @@ -40,7 +40,7 @@ ApplicationWindow { else audio.index = playlist.count - 1 - playbackControls.song = playlist.get(audio.index).name + " - " + playlist.get(audio.index).group + "" + playbackControls.song = playlist.get(audio.index).name + " - " + playlist.get(audio.index).artist + "" audio.source = playlist.get(audio.index).url audio.play() } @@ -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 + " - " + playlist.get(audio.index).group + "" + playbackControls.song = playlist.get(audio.index).name + " - " + playlist.get(audio.index).artist + "" audio.source = playlist.get(audio.index).url audio.play() } else if (audio.status == Audio.EndOfMedia) { diff --git a/qml/testModels/TestSearchModel.qml b/qml/testModels/TestSearchModel.qml index 257a23f..ea97e0d 100644 --- a/qml/testModels/TestSearchModel.qml +++ b/qml/testModels/TestSearchModel.qml @@ -4,7 +4,7 @@ ListModel { id: testModel ListElement { name: "Labios Rotos" - group: "Zoe" + artist: "Zoe" picture: "zoe" length: "3:40" comment: "Bonita canción" @@ -13,7 +13,7 @@ ListModel { } ListElement { name: "Yesterday" - group: "The Beatles" + artist: "The Beatles" picture: "beatles" length: "2:58" comment: "The yellow submarine!" @@ -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!" @@ -31,7 +31,7 @@ ListModel { } ListElement { name: "hips don't lie" - group: "Shakira" + artist: "Shakira" picture: "shakira" length: "3:22" comment: "Waka waka!" @@ -40,7 +40,7 @@ ListModel { } ListElement { name: "Hotel Room Service" - group: "Pitbull" + artist: "Pitbull" picture: "pitbull" length: "4:15" comment: "Ya tu sabe!" @@ -49,7 +49,7 @@ ListModel { } ListElement { name: "Song Name" - group: "Fake" + artist: "Fake" picture: "crazystuff" length: "3:10" comment: "This a long useful comment" diff --git a/src/downloader.cpp b/src/downloader.cpp index 38184da..c2198f8 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -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; @@ -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("
  • ")); - 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") { diff --git a/src/downloader.h b/src/downloader.h index f0c6eac..32c3de0 100644 --- a/src/downloader.h +++ b/src/downloader.h @@ -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); diff --git a/src/musicstreamer.cpp b/src/musicstreamer.cpp index 6709d43..7c078e4 100644 --- a/src/musicstreamer.cpp +++ b/src/musicstreamer.cpp @@ -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(); @@ -92,8 +92,8 @@ QVariant MusicStreamer::data(const QModelIndex & index, int role) const Song *song = qobject_cast(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) @@ -121,7 +121,7 @@ QHash MusicStreamer::roleNames() const { QHash roles; roles[NameRole] = "name"; - roles[GroupRole] = "group"; + roles[ArtistRole] = "artist"; roles[LengthRole] = "length"; roles[CommentRole] = "comment"; roles[KbpsRole] = "kbps"; diff --git a/src/musicstreamer.h b/src/musicstreamer.h index dc031ad..f44d7e1 100644 --- a/src/musicstreamer.h +++ b/src/musicstreamer.h @@ -17,7 +17,7 @@ class MusicStreamer : public QAbstractListModel public: enum DownloaderRoles { NameRole = Qt::UserRole + 1, - GroupRole, + ArtistRole, LengthRole, CommentRole, KbpsRole, @@ -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); diff --git a/src/song.cpp b/src/song.cpp index 71fe18b..8859cde 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -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), @@ -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 diff --git a/src/song.h b/src/song.h index bc3b0e4..d44d667 100644 --- a/src/song.h +++ b/src/song.h @@ -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) @@ -21,11 +21,11 @@ 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; @@ -33,7 +33,7 @@ class Song : public QObject 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); @@ -48,7 +48,7 @@ class Song : public QObject signals: void nameChanged(); - void groupChanged(); + void artistChanged(); void lengthChanged(); void commentChanged(); void codeChanged(); @@ -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;