~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to noatun/noatun/modules/liszt/ArtistItem.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2000 Rik Hemsley (rikkus) <rik@kde.org>. All rights reserved.
 
3
 *
 
4
LICENSE
 
5
 */
 
6
 
 
7
#include <qpixmap.h>
 
8
#include <qpainter.h>
 
9
 
 
10
#include "Static.h"
 
11
#include "CharlatanItem.h"
 
12
#include "ArtistItem.h"
 
13
#include "AlbumItem.h"
 
14
 
 
15
ArtistItem::ArtistItem(
 
16
    QListView * parent,
 
17
    QString artist
 
18
                      )
 
19
  : CharlatanItem(parent, artist),
 
20
    artist_(artist)
 
21
{
 
22
  setExpandable(true);
 
23
  setPixmap(0, Static::instance()->pixmap("artist"));
 
24
 
 
25
#if 0
 
26
  KConfig * c(KGlobal::config());
 
27
 
 
28
  c->setGroup("General");
 
29
  QStringList l(c->readListEntry("OpenArtists"));
 
30
 
 
31
  if (0 != l.contains(artist_))
 
32
    setOpen(true);
 
33
#endif
 
34
}
 
35
 
 
36
ArtistItem::~ArtistItem()
 
37
{
 
38
}
 
39
 
 
40
  void
 
41
ArtistItem::setOpen(bool b)
 
42
{
 
43
  CharlatanItem::setOpen(b);
 
44
#if 0
 
45
 
 
46
  KConfig * c(KGlobal::config());
 
47
 
 
48
  c->setGroup("General");
 
49
 
 
50
  QStringList l(c->readListEntry("OpenArtists"));
 
51
 
 
52
  if (b) {
 
53
    if (0 == l.contains(artist_)) {
 
54
      l.append(artist_);
 
55
      c->writeEntry("OpenArtists", l);
 
56
    }
 
57
  } else {
 
58
    QStringList::Iterator it = l.find(artist_);
 
59
    if (it != l.end()) {
 
60
      l.remove(it);
 
61
      c->writeEntry("OpenArtists", l);
 
62
    }
 
63
  }
 
64
#endif
 
65
}
 
66
 
 
67
  AlbumItem *
 
68
ArtistItem::albumItem(QString name)
 
69
{
 
70
  AlbumItem * i = static_cast<AlbumItem *>(firstChild());
 
71
 
 
72
  while (i) {
 
73
 
 
74
    if (i->name() == name)
 
75
      return i;
 
76
 
 
77
    i = static_cast<AlbumItem *>(i->nextSibling());
 
78
  }
 
79
 
 
80
  i = new AlbumItem(this, artist_, name);
 
81
  return i;
 
82
}
 
83
 
 
84
  void
 
85
ArtistItem::increaseScore()
 
86
{
 
87
  AlbumItem * i = static_cast<AlbumItem *>(firstChild());
 
88
 
 
89
  while (0 != i) {
 
90
    i->increaseScore();
 
91
    i = static_cast<AlbumItem *>(i->nextSibling());
 
92
  }
 
93
}
 
94
 
 
95
  void
 
96
ArtistItem::decreaseScore()
 
97
{
 
98
  AlbumItem * i = static_cast<AlbumItem *>(firstChild());
 
99
 
 
100
  while (0 != i) {
 
101
    i->decreaseScore();
 
102
    i = static_cast<AlbumItem *>(i->nextSibling());
 
103
  }
 
104
}
 
105
 
 
106