1 /* This file is part of the KDE Project
2 Copyright (c) 2004 K�in Ottens <ervin ipsquad net>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
22 #include "amarok_export.h"
27 #include <QStringList>
30 class AMAROK_EXPORT Medium
33 typedef QList
<Medium
> List
;
35 static const uint AUTODETECTED
= 0;
36 static const uint ID
= 1;
37 static const uint NAME
= 2;
38 static const uint LABEL
= 3;
39 static const uint USER_LABEL
= 4;
40 static const uint MOUNTABLE
= 5;
41 static const uint DEVICE_NODE
= 6;
42 static const uint MOUNT_POINT
= 7;
43 static const uint FS_TYPE
= 8;
44 static const uint MOUNTED
= 9;
45 static const uint BASE_URL
= 10;
46 static const uint MIME_TYPE
= 11;
47 static const uint ICON_NAME
= 12;
48 static const uint PROPERTIES_COUNT
= 13;
49 static const QString SEPARATOR
;
52 Medium(const Medium
*medium
);
53 Medium(const QString
&id
, const QString
&name
);
54 static const Medium
create(const QStringList
&properties
);
55 static List
createList(const QStringList
&properties
);
57 const QStringList
&properties() const { return m_properties
; }
59 bool isAutodetected() const { return m_properties
[AUTODETECTED
]=="true"; }
60 QString
id() const { return m_properties
[ID
]; }
61 QString
name() const { return m_properties
[NAME
]; }
62 QString
label() const { return m_properties
[LABEL
]; }
63 QString
userLabel() const { return m_properties
[USER_LABEL
]; }
64 bool isMountable() const { return m_properties
[MOUNTABLE
]=="true"; }
65 QString
deviceNode() const { return m_properties
[DEVICE_NODE
]; }
66 QString
mountPoint() const { return m_properties
[MOUNT_POINT
]; }
67 QString
fsType() const { return m_properties
[FS_TYPE
]; }
68 bool isMounted() const { return m_properties
[MOUNTED
]=="true"; }
69 QString
baseURL() const { return m_properties
[BASE_URL
]; }
70 QString
mimeType() const { return m_properties
[MIME_TYPE
]; }
71 QString
iconName() const { return m_properties
[ICON_NAME
]; }
73 bool needMounting() const;
74 KUrl
prettyBaseURL() const;
75 QString
prettyLabel() const;
77 void setAutodetected(bool autodetected
);
78 void setId(const QString
&id
);
79 void setMountPoint(const QString
&mountPoint
);
80 void setName(const QString
&name
);
81 void setLabel(const QString
&label
);
82 void setUserLabel(const QString
&label
);
83 void setFsType(const QString
&type
);
85 bool mountableState(bool mounted
);
86 void mountableState(const QString
&deviceNode
,
87 const QString
&mountPoint
,
88 const QString
&fsType
, bool mounted
);
89 void unmountableState(const QString
&baseURL
= QString());
91 void setMimeType(const QString
&mimeType
);
92 void setIconName(const QString
&iconName
);
97 QStringList m_properties
;
99 //i have no idea why this is necessary. maxx_k
100 //friend class QValueListNode<const Medium>;