37
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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 |
* The header file for messaging's audio fetcher model
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#ifndef MSGAUDIOFETCHERMODEL_H
|
|
20 |
#define MSGAUDIOFETCHERMODEL_H
|
|
21 |
|
|
22 |
// SYSTEM INCLUDES
|
|
23 |
#include <QStandardItemModel>
|
|
24 |
#include <QStringList>
|
|
25 |
#include <QDir>
|
|
26 |
|
|
27 |
// FORWARD DECLARATIONS
|
|
28 |
class MsgAudioSelectionEngine;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* @class MsgAudioFetcherModel
|
|
32 |
* @brief This class is messaging's audio fetcher model
|
|
33 |
*/
|
|
34 |
class MsgAudioFetcherModel : public QStandardItemModel
|
|
35 |
{
|
|
36 |
Q_OBJECT
|
|
37 |
|
|
38 |
public:
|
|
39 |
/**
|
|
40 |
* Constructor
|
|
41 |
*/
|
|
42 |
explicit MsgAudioFetcherModel(QObject *parent);
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Destructor
|
|
46 |
*/
|
|
47 |
virtual ~MsgAudioFetcherModel();
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Clears model
|
|
51 |
*/
|
|
52 |
void clearAll();
|
|
53 |
|
|
54 |
/**
|
|
55 |
* adds a row into the model
|
|
56 |
*/
|
|
57 |
void addRow(QString filepath);
|
|
58 |
|
|
59 |
public: //from QAbstractItemModel
|
|
60 |
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
61 |
|
|
62 |
private:
|
|
63 |
/**
|
|
64 |
* binary search (ascendant) for the correct index to insert.
|
|
65 |
* @param low the start of search
|
|
66 |
* @param high the end of search.
|
|
67 |
* @return the correct index
|
|
68 |
*/
|
|
69 |
int insertIndex(int low, int high, QString variant);
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Add audio files into the model
|
|
73 |
* @param toneDir, Dir from which to get audio files to add to model
|
|
74 |
*/
|
|
75 |
void addToneFiles(QDir& toneDir);
|
|
76 |
|
|
77 |
/**
|
|
78 |
* Finds and adds audio files into the model
|
|
79 |
*/
|
|
80 |
void getRomToneFiles();
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Initialize the model
|
|
84 |
*/
|
|
85 |
void init();
|
|
86 |
|
|
87 |
/**
|
|
88 |
* checks if the given file is DRM protected
|
|
89 |
* @param filepath, path of audio file
|
|
90 |
*/
|
|
91 |
bool isDRM(QString filepath);
|
|
92 |
|
|
93 |
private slots:
|
|
94 |
/**
|
|
95 |
* Handle MDS session open
|
|
96 |
*/
|
|
97 |
void mdeSessionOpened();
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Handle MDS session open error
|
|
101 |
*/
|
|
102 |
void mdeSessionError(int error);
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Handle MDS query complete
|
|
106 |
*/
|
|
107 |
void queryComplete(const QStringList &nameList,
|
|
108 |
const QStringList &uriList);
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Handle MDS query error
|
|
112 |
*/
|
|
113 |
void queryError(int error);
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Handle object observer callback
|
|
117 |
*/
|
|
118 |
void onObjectChanged();
|
|
119 |
|
|
120 |
private:
|
|
121 |
/**
|
|
122 |
* audio selection engine
|
|
123 |
*/
|
|
124 |
MsgAudioSelectionEngine* mSelectionEngine;
|
|
125 |
};
|
|
126 |
|
|
127 |
#endif /* MsgAudioFetcherModel_H_ */
|