|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef RADIOHISTORYITEM_H |
|
19 #define RADIOHISTORYITEM_H |
|
20 |
|
21 // System includes |
|
22 #include <QMetaType> |
|
23 #include <QObject> |
|
24 |
|
25 // User includes |
|
26 #include "radiouiengineexport.h" |
|
27 |
|
28 // Forward declarations |
|
29 class RadioHistoryItemPrivate; |
|
30 |
|
31 /*! |
|
32 * Radio history item implements a song recognized from the radio broadcast |
|
33 * |
|
34 * Note! It is derived from QObject even though architecturally it shouldn't be. |
|
35 * It is done only to satisfy the WINSCW build which doesn't export the destructor in UREL |
|
36 * build. This causes mismatching def files and annoying warnings. Deriving from QObject fixes this |
|
37 */ |
|
38 class UI_ENGINE_DLL_EXPORT RadioHistoryItem : public QObject |
|
39 { |
|
40 public: |
|
41 |
|
42 RadioHistoryItem(); |
|
43 RadioHistoryItem( const QString& artist, const QString& title ); |
|
44 RadioHistoryItem( const RadioHistoryItem& other ); |
|
45 |
|
46 ~RadioHistoryItem(); |
|
47 |
|
48 RadioHistoryItem& operator=( const RadioHistoryItem& other ); |
|
49 |
|
50 QString artist() const; |
|
51 void setArtist( const QString& artist ); |
|
52 |
|
53 QString title() const; |
|
54 void setTitle( const QString& title ); |
|
55 |
|
56 QString station() const; |
|
57 void setStation( const QString& station ); |
|
58 |
|
59 uint frequency() const; |
|
60 void setFrequency( uint frequency ); |
|
61 |
|
62 QString time() const; |
|
63 void setCurrentTime(); |
|
64 |
|
65 bool isFavorite() const; |
|
66 void setFavorite(); |
|
67 |
|
68 void increasePlayCount(); |
|
69 int playCount() const; |
|
70 |
|
71 private: |
|
72 |
|
73 /** |
|
74 * Decrements the reference count of the implicitly shared data. |
|
75 * Data is deleted if no instance uses it anymore. |
|
76 */ |
|
77 void decrementReferenceCount(); |
|
78 |
|
79 private: // data |
|
80 |
|
81 /** |
|
82 * Pointer to the implicitly shared private implementation |
|
83 * Own. |
|
84 */ |
|
85 class RadioHistoryItemPrivate* mData; |
|
86 |
|
87 public: |
|
88 |
|
89 /** |
|
90 * Detach from the implicitly shared data |
|
91 */ |
|
92 void detach(); |
|
93 |
|
94 /** |
|
95 * Checks if the class is detached from implicitly shared data |
|
96 * Required by many QT convenience functions for implicitly shared classes |
|
97 */ |
|
98 bool isDetached() const; |
|
99 |
|
100 typedef RadioHistoryItemPrivate* DataPtr; |
|
101 inline DataPtr &data_ptr() { return mData; } |
|
102 |
|
103 }; |
|
104 |
|
105 Q_DECLARE_TYPEINFO( RadioHistoryItem, Q_MOVABLE_TYPE ); // Can be moved around in memory by containers if necessary |
|
106 Q_DECLARE_SHARED( RadioHistoryItem ) // Uses implicit sharing |
|
107 Q_DECLARE_METATYPE( RadioHistoryItem ) // To be usable in a QVariant |
|
108 |
|
109 #endif // RADIOHISTORYITEM_H |