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

« back to all changes in this revision

Viewing changes to noatun/noatun/modules/liszt/TrackItem.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 <qlistview.h>
 
9
 
 
10
#include "Static.h"
 
11
#include "PlayLiszt.h"
 
12
#include "TrackItem.h"
 
13
#include "Track.h"
 
14
#include "AlbumItem.h"
 
15
 
 
16
TrackItem::TrackItem(
 
17
    AlbumItem * parent,
 
18
    Track * t
 
19
)
 
20
  : CharlatanItem(parent, t->name()),
 
21
    track_(t)
 
22
{
 
23
  setPixmap(0, Static::instance()->pixmap("track"));
 
24
  setText(1, QString::number(QABS(track_->score())));
 
25
}
 
26
 
 
27
TrackItem::~TrackItem()
 
28
{
 
29
}
 
30
 
 
31
  QString
 
32
TrackItem::key(int, bool) const
 
33
{
 
34
  QString s;
 
35
  s.sprintf("%016d", track_->fileScore());
 
36
  return s;
 
37
}
 
38
 
 
39
  void
 
40
TrackItem::increaseScore()
 
41
{
 
42
  PlayLiszt::instance()->increaseScore(track_);
 
43
  setText(1, QString::number(QABS(track_->score())));
 
44
 
 
45
  if (track_->score() == 0)
 
46
    setSelectable(false);
 
47
  else
 
48
    if (!isSelectable())
 
49
      setSelectable(true);
 
50
}
 
51
 
 
52
  void
 
53
TrackItem::decreaseScore()
 
54
{
 
55
  PlayLiszt::instance()->decreaseScore(track_);
 
56
  setText(1, QString::number(QABS(track_->score())));
 
57
 
 
58
  if (track_->score() == 0)
 
59
    setSelectable(false);
 
60
  else
 
61
    if (!isSelectable())
 
62
      setSelectable(true);
 
63
}