Debian Codegraph @

src/playlistitem.cpp

raw symbols SCIP
1 /*
2 Copyright (C) 2005-2014 Mario Stephan <[email protected]>
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "playlistitem.h"cxx . . $ `<file>/src/playlistitem.h`/
19 #include "playlist.h"cxx . . $ `<file>/src/playlist.h`/
20 #include "ratingwidget.h"cxx . . $ `<file>/src/ratingwidget.h`/
21
22 #include <QObject>
23 #include <qdebug.h>
24 #include <qlistview.h>
25
26 PlaylistItemcxx . . $ PlaylistItem#::PlaylistItemcxx . . $ PlaylistItem#PlaylistItem(12133e763ddaf43d).(Playlistcxx . . $ Playlist#* parent, QTreeWidgetItemcxx . . $ QTreeWidgetItem#* lvi)
27 : QTreeWidgetItemcxx . . $ QTreeWidgetItem#QTreeWidgetItem(e8e3c0b78817b0dc).(parent, lvi)
28 , m_trackcxx . . $ PlaylistItem#m_track.(new Trackcxx . . $ Track#())
29 , m_parentcxx . . $ PlaylistItem#m_parent.(parent)
30 {
31 //qDebug() << u << " 2."<<m_url;
32 }
33
34 PlaylistItemcxx . . $ PlaylistItem#::~cxx . . $ PlaylistItem#`~PlaylistItem`(ced63f7c635d850d).PlaylistItemcxx . . $ PlaylistItem#()
35 {
36 if (m_trackcxx . . $ PlaylistItem#m_track.)
37 delete m_trackcxx . . $ PlaylistItem#m_track.;
38 }
39
40 void PlaylistItemcxx . . $ PlaylistItem#::setTrackcxx . . $ PlaylistItem#setTrack(c7ced298c7283c1a).(Trackcxx . . $ Track#* track)
41 {
42 m_trackcxx . . $ PlaylistItem#m_track. = track;
43 setTextscxx . . $ PlaylistItem#setTexts(c7ced298c7283c1a).(m_trackcxx . . $ PlaylistItem#m_track.);
44 }
45
46 void PlaylistItemcxx . . $ PlaylistItem#::setTextscxx . . $ PlaylistItem#setTexts(c7ced298c7283c1a).(Trackcxx . . $ Track#* track)
47 {
48 //qDebug()<<track->url();
49
50 setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(Column_Urlcxx . . $ PlaylistItem#Column_Url., track->urlcxx . . $ Track#url(db502ccec337722f).().toStringcxx . . $ QUrl#toString(632475ebea3355f1).());
51 setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(Column_Artistcxx . . $ PlaylistItem#Column_Artist., (track->artistcxx . . $ Track#artist(4365c3963150523e).() !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "") ? track->artistcxx . . $ Track#artist(4365c3963150523e).() : QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Unknown"));
52 setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(Column_Titlecxx . . $ PlaylistItem#Column_Title., (track->titlecxx . . $ Track#title(4365c3963150523e).() !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "") ? track->titlecxx . . $ Track#title(4365c3963150523e).() : QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Unknown"));
53 setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(Column_Albumcxx . . $ PlaylistItem#Column_Album., track->albumcxx . . $ Track#album(4365c3963150523e).());
54 setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(Column_Yearcxx . . $ PlaylistItem#Column_Year., track->yearcxx . . $ Track#year(4365c3963150523e).());
55 setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(Column_Genrecxx . . $ PlaylistItem#Column_Genre., track->genrecxx . . $ Track#genre(4365c3963150523e).());
56 setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(Column_Lengthcxx . . $ PlaylistItem#Column_Length., track->prettyLengthcxx . . $ Track#prettyLength(4365c3963150523e).());
57 setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(Column_Tracknumbercxx . . $ PlaylistItem#Column_Tracknumber., track->tracknumbercxx . . $ Track#tracknumber(4365c3963150523e).());
58 setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(Column_Playedcxx . . $ PlaylistItem#Column_Played., QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(track->countercxx . . $ Track#counter(b126dc7c1de90089).()));
59
60 const QStringcxx . . $ QString# body = "<tr><td><b>%1</b></td><td>%2</td></tr>"cxx . . $ QString#QString(85c52e162fed56f9).;
61
62 QStringcxx . . $ QString#
63 str
64 = "<html><body><table STYLE=\"border-collapse: collapse\"> width=\"100%\" border=\"1\">"cxx . . $ QString#QString(85c52e162fed56f9).;
65 str +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). body.argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Title"), track->titlecxx . . $ Track#title(4365c3963150523e).());
66 str +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). body.argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Artist"), track->artistcxx . . $ Track#artist(4365c3963150523e).());
67 str +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). body.argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Album"), track->albumcxx . . $ Track#album(4365c3963150523e).());
68 str +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). body.argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Genre"), track->genrecxx . . $ Track#genre(4365c3963150523e).());
69 str +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). body.argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Year"), track->yearcxx . . $ Track#year(4365c3963150523e).());
70 str +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). body.argcxx . . $ QString#arg(ec0c7a4bb7c7a5fe).(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Location"), track->urlcxx . . $ Track#url(db502ccec337722f).().toStringcxx . . $ QUrl#toString(632475ebea3355f1).());
71 str +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "</table></body></html>";
72
73 setToolTipcxx . . $ QTreeWidgetItem#setToolTip(4b11a7293b4ed91c).(Column_Artistcxx . . $ PlaylistItem#Column_Artist., str);
74
75 m_trackcxx . . $ PlaylistItem#m_track. = track;
76 }
77
78 void PlaylistItemcxx . . $ PlaylistItem#::setTextcxx . . $ PlaylistItem#setText(909c33aa10af95dd).(int c, QStringcxx . . $ QString# text)
79 {
80 QTreeWidgetItemcxx . . $ QTreeWidgetItem#::setTextcxx . . $ QTreeWidgetItem#setText(4b11a7293b4ed91c).(c, (text !=cxx . . $ QString#`operator!=`(7d4bdb1abc417636). "") ? textcxx . . $ QString#QString(132dd6869045752b). : QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Unknown"));
81 switch (c) {
82 case Column_Urlcxx . . $ PlaylistItem#Column_Url.:
83 m_trackcxx . . $ PlaylistItem#m_track.->setUrlcxx . . $ Track#setUrl(fe09fe9c2ffe9947).(QUrlcxx . . $ QUrl#::fromLocalFilecxx . . $ QUrl#fromLocalFile(daf4b0201622af21).(text));
84 break;
85 case Column_Artistcxx . . $ PlaylistItem#Column_Artist.:
86 m_trackcxx . . $ PlaylistItem#m_track.->setArtistcxx . . $ Track#setArtist(7df51288a9ebd664).(textcxx . . $ QString#QString(132dd6869045752b).);
87 break;
88 case Column_Titlecxx . . $ PlaylistItem#Column_Title.:
89 m_trackcxx . . $ PlaylistItem#m_track.->setTitlecxx . . $ Track#setTitle(7df51288a9ebd664).(textcxx . . $ QString#QString(132dd6869045752b).);
90 break;
91 case Column_Albumcxx . . $ PlaylistItem#Column_Album.:
92 m_trackcxx . . $ PlaylistItem#m_track.->setAlbumcxx . . $ Track#setAlbum(7df51288a9ebd664).(textcxx . . $ QString#QString(132dd6869045752b).);
93 break;
94 case Column_Playedcxx . . $ PlaylistItem#Column_Played.:
95 m_trackcxx . . $ PlaylistItem#m_track.->setCountercxx . . $ Track#setCounter(7df51288a9ebd664).(textcxx . . $ QString#QString(132dd6869045752b).);
96 break;
97 case Column_Genrecxx . . $ PlaylistItem#Column_Genre.:
98 m_trackcxx . . $ PlaylistItem#m_track.->setGenrecxx . . $ Track#setGenre(7df51288a9ebd664).(textcxx . . $ QString#QString(132dd6869045752b).);
99 break;
100 case Column_Lengthcxx . . $ PlaylistItem#Column_Length.:
101 m_trackcxx . . $ PlaylistItem#m_track.->setLengthcxx . . $ Track#setLength(7df51288a9ebd664).(textcxx . . $ QString#QString(132dd6869045752b).);
102 break;
103 }
104 }
105
106 void PlaylistItemcxx . . $ PlaylistItem#::updatecxx . . $ PlaylistItem#update(49f6e7a06ebc5aa8).()
107 {
108 // paint item in special color
109 for (int i = 0; i <= columnCountcxx . . $ QTreeWidgetItem#columnCount(455f465bc33b4cdf).() - 1; i++)
110 setForegroundcxx . . $ QTreeWidgetItem#setForeground(5d5d909b94e7ae19).(i, QBrushcxx . . $ QBrush#QBrush(b50947b0752ea6ac).(m_foreColorcxx . . $ PlaylistItem#m_foreColor.));
111 }
112
113 int PlaylistItemcxx . . $ PlaylistItem#::ratecxx . . $ PlaylistItem#rate(b126dc7c1de90089).()
114 {
115 return ((RatingWidgetcxx . . $ RatingWidget#*)m_parentcxx . . $ PlaylistItem#m_parent.->itemWidgetcxx . . $ QTreeWidget#itemWidget(8f1e5c04f8e4e2c8).(this, Column_Ratecxx . . $ PlaylistItem#Column_Rate.))->ratingcxx . . $ RatingWidget#rating(5036dfe8d4170af2).() * 0.1;
116 }
117
118 bool PlaylistItemcxx . . $ PlaylistItem#::operatorcxx . . $ PlaylistItem#`operator<`(1e215ead71844640).<(const QTreeWidgetItemcxx . . $ QTreeWidgetItem#& other) const
119 {
120 bool ok;
121 int sortCol = treeWidgetcxx . . $ QTreeWidgetItem#treeWidget(38e1593ce2a8904b).()->sortColumncxx . . $ QTreeWidget#sortColumn(455f465bc33b4cdf).();
122 QStringcxx . . $ QString# otherText = othercxx . . $ QString#QString(132dd6869045752b)..textcxx . . $ QTreeWidgetItem#text(3f3c3d0e9c0eb37f).(sortCol).replacecxx . . $ QString#replace(192e628656427d1c).(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Unknown"), "0"cxx . . $ QString#QString(85c52e162fed56f9).);
123
124 if (sortCol == Column_Lengthcxx . . $ PlaylistItem#Column_Length.) {
125 int otherLength = -1;
126 if (otherText.containscxx . . $ QString#contains(7cf081d1b6a1defd).(':'cxx . . $ QChar#QChar(f349c77f591a7878).)) {
127 QStringListcxx . . $ QStringList# list = otherText.splitcxx . . $ QString#split(92030b8bf74e4227).(':'cxx . . $ QChar#QChar(f349c77f591a7878).);
128 otherLength = list.atcxx . . $ QList#at(e2681f9bb6b2f357).(0).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(&ok) * 60;
129 otherLength += list.atcxx . . $ QList#at(e2681f9bb6b2f357).(1).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(&ok);
130 if (ok)
131 return m_trackcxx . . $ PlaylistItem#m_track.->lengthcxx . . $ Track#length(b126dc7c1de90089).() < otherLength;
132 }
133 } else {
134 int value = textcxx . . $ QTreeWidgetItem#text(3f3c3d0e9c0eb37f).(sortCol).replacecxx . . $ QString#replace(192e628656427d1c).(QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Unknown"), "0"cxx . . $ QString#QString(85c52e162fed56f9).).toIntcxx . . $ QString#toInt(d7972accae11ee1f).(&ok);
135 int otherValue = otherText.toIntcxx . . $ QString#toInt(d7972accae11ee1f).(&ok);
136 if (ok)
137 return value < otherValue;
138 }
139
140 return QTreeWidgetItemcxx . . $ QTreeWidgetItem#::operator<(other);
141 }