Debian Codegraph @

src/collectiontreeitem.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 "collectiontreeitem.h"
19
20 struct CollectionTreeItemPrivate {
21 QString artist;
22 QString album;
23 QString year;
24 QString genre;
25 };
26
27 CollectionTreeItem::CollectionTreeItem(QTreeWidget* parent, int type)
28 : QTreeWidgetItem(parent, type)
29 , p(new CollectionTreeItemPrivate)
30 {
31 setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
32 }
33
34 CollectionTreeItem::CollectionTreeItem(QTreeWidgetItem* parent, int type)
35 : QTreeWidgetItem(parent, type)
36 , p(new CollectionTreeItemPrivate)
37 {
38 }
39
40 CollectionTreeItem::~CollectionTreeItem()
41 {
42 delete p;
43 }
44
45 QString CollectionTreeItem::artist()
46 {
47 return p->artist;
48 }
49
50 QString CollectionTreeItem::album()
51 {
52 return p->album;
53 }
54
55 QString CollectionTreeItem::year()
56 {
57 return p->year;
58 }
59
60 QString CollectionTreeItem::genre()
61 {
62 return p->genre;
63 }
64
65 void CollectionTreeItem::setArtist(QString value)
66 {
67 p->artist = value;
68 setTextString(value);
69 QTreeWidgetItem::setIcon(0, QIcon(style()->standardIcon(QStyle::SP_DirHomeIcon).pixmap(12)));
70 }
71
72 void CollectionTreeItem::setAlbum(QString value)
73 {
74 p->album = value;
75 setTextString(value);
76 QTreeWidgetItem::setIcon(0, QIcon(style()->standardIcon(QStyle::SP_DriveCDIcon).pixmap(12)));
77 }
78
79 void CollectionTreeItem::setYear(QString value)
80 {
81 p->year = value;
82 setTextString(value);
83 QTreeWidgetItem::setIcon(0, QIcon(style()->standardIcon(QStyle::SP_FileIcon).pixmap(12)));
84 }
85
86 void CollectionTreeItem::setGenre(QString value)
87 {
88 p->genre = value;
89 setTextString(value);
90 QTreeWidgetItem::setIcon(0, QIcon(style()->standardIcon(QStyle::SP_DirIcon).pixmap(12)));
91 }
92
93 void CollectionTreeItem::setTextString(QString value)
94 {
95 if (value == QString::null) {
96 setText(0, QString("( %1 )").arg(tr("All")));
97 setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicator);
98 } else
99 setText(0, value);
100 }