File: tune.cpp

package info (click to toggle)
jreen 1.2.0%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,932 kB
  • sloc: cpp: 31,281; makefile: 14
file content (123 lines) | stat: -rw-r--r-- 2,313 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/****************************************************************************
**
** Jreen
**
** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
**
*****************************************************************************
**
** $JREEN_BEGIN_LICENSE$
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program.  If not, see http://www.gnu.org/licenses/.
** $JREEN_END_LICENSE$
**
****************************************************************************/

#include "tune.h"
#include <QUrl>

namespace Jreen
{
	class TunePrivate
	{
	public:
		QString artist;
		int length;
		int rating;
		QString source;
		QString title;
		QString track;
		QUrl uri;
	};
	
	Tune::Tune() : d_ptr(new TunePrivate)
	{
		Q_D(Tune);
		d->length = -1;
		d->rating = -1;
	}

	Tune::~Tune()
	{
	}

	void Tune::setArtist(const QString &artist)
	{
		d_func()->artist = artist;
	}

	QString Tune::artist() const
	{
		return d_func()->artist;
	}
	
	void Tune::setLength(int length)
	{
		d_func()->length = qMax(length, -1);
	}

	int Tune::length() const
	{
		return d_func()->length;
	}
	
	void Tune::setRating(int rating)
	{
		d_func()->rating = qBound(-1, rating, 10);
	}

	int Tune::rating() const
	{
		return d_func()->rating;
	}
	
	void Tune::setSource(const QString &source)
	{
		d_func()->source = source;
	}

	QString Tune::source() const
	{
		return d_func()->source;
	}
	
	void Tune::setTitle(const QString &title)
	{
		d_func()->title = title;
	}

	QString Tune::title() const
	{
		return d_func()->title;
	}
	
	void Tune::setTrack(const QString &track)
	{
		d_func()->track = track;
	}

	QString Tune::track() const
	{
		return d_func()->track;
	}
	
	void Tune::setUri(const QUrl &uri)
	{
		d_func()->uri = uri;
	}

	QUrl Tune::uri() const
	{
		return d_func()->uri;
	}
}