21
|
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 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef ZEROCONFSHARINGUI_H
|
|
19 |
#define ZEROCONFSHARINGUI_H
|
|
20 |
|
|
21 |
#include <QObject>
|
|
22 |
#include <QtGui>
|
|
23 |
#include <QTimer>
|
|
24 |
#include <QFile>
|
|
25 |
#include <QNetworkAccessManager>
|
|
26 |
#include <QNetworkReply>
|
|
27 |
#include <f32file.h>
|
|
28 |
|
|
29 |
#include "ui_mainwindow.h"
|
|
30 |
#include "zeroconfclient.h"
|
|
31 |
|
|
32 |
#include <mdns/dnsconstants.h>
|
|
33 |
#include <e32hashtab.h>
|
|
34 |
#include "musicprovider.h"
|
|
35 |
|
|
36 |
class MNowPlayObserver
|
|
37 |
{
|
|
38 |
public:
|
|
39 |
virtual void NowPlaying(TDes& aTitleBuf) = 0;
|
|
40 |
};
|
|
41 |
|
|
42 |
|
|
43 |
class CHttpServer;
|
|
44 |
class CHttpClient;
|
|
45 |
class CContactInfo;
|
|
46 |
|
|
47 |
class QZeroConfSharingUi : public QMainWindow , MPnPObserver, MNowPlayObserver
|
|
48 |
{
|
|
49 |
Q_OBJECT
|
|
50 |
|
|
51 |
public:
|
|
52 |
QZeroConfSharingUi(QWidget *parent = 0);
|
|
53 |
~QZeroConfSharingUi();
|
|
54 |
|
|
55 |
void setIcon(const QIcon &icon);
|
|
56 |
void setSize(const QSize &size);
|
|
57 |
|
|
58 |
void OnPnPEventL (RPnPParameterBundleBase& aServiceEventInfo);
|
|
59 |
void OnPnPError (TInt aError);
|
|
60 |
|
|
61 |
void DiscoverServices();
|
|
62 |
void GetSrvInfo(const TDesC8& aQueryString,TDnsType aType);
|
|
63 |
void PublishService();
|
|
64 |
void FetchBaseUrl(RArray <RBuf8> aTxtData);
|
|
65 |
void FetchIconUrl(RArray <RBuf8> aTxtData);
|
|
66 |
void FetchFileUrl(RArray <RBuf8> aTxtData);
|
|
67 |
void FetchCurrentlyPlaying(RArray <RBuf8> aTxtData);
|
|
68 |
void FetchStatus(RArray <RBuf8> aTxtData);
|
|
69 |
|
|
70 |
void PublishMyService(const TDesC8& afilelist,const TDesC8& aIconName);
|
|
71 |
CContactInfo* Clone(CContactInfo* aContact);
|
|
72 |
|
|
73 |
void NowPlaying(TDes& aTitleBuf);
|
|
74 |
|
|
75 |
CContactInfo* Create_Icon_Contact();
|
|
76 |
|
|
77 |
void ShowCur_Status_and_Track();
|
|
78 |
|
|
79 |
private:
|
|
80 |
enum TCommand
|
|
81 |
{
|
|
82 |
EStart = 1,
|
|
83 |
EStop,
|
|
84 |
EExit,
|
|
85 |
};
|
|
86 |
|
|
87 |
enum TTabEnum
|
|
88 |
{
|
|
89 |
ETabContacts,
|
|
90 |
ETabContact,
|
|
91 |
ETabMusic,
|
|
92 |
ETabVideo,
|
|
93 |
ETabChat,
|
|
94 |
ETabFileSharing
|
|
95 |
};
|
|
96 |
|
|
97 |
QTabWidget* tabWidget;
|
|
98 |
//Ui::ContactTabWidget* contactWidget;
|
|
99 |
QTimer* iTimer;
|
|
100 |
|
|
101 |
QStringList iContacts;
|
|
102 |
QStringList iCommunities;
|
|
103 |
QString iSelectedContact;
|
|
104 |
QString iSelectedFileListName;
|
|
105 |
QString iSelectedFileName;
|
|
106 |
|
|
107 |
void PopulateUserList();
|
|
108 |
void PopulateCommunityList();
|
|
109 |
void ShowAllContacts(bool aShow);
|
|
110 |
void ShowBackButtons(bool aShow);
|
|
111 |
void PopulateMainWindow(QString qname);
|
|
112 |
void RequestSharedContent();
|
|
113 |
void Log(const char* msg);
|
|
114 |
|
|
115 |
CContactInfo* GetSelectedContact(const TDesC8& aConatactName);
|
|
116 |
|
|
117 |
void PopulateContactSpecificData();
|
|
118 |
void ReadFile();
|
|
119 |
Ui::MainWindow ui;
|
|
120 |
bool isShared;
|
|
121 |
|
|
122 |
CZeroconfClient* iZeroConfClient;
|
|
123 |
CMusicProvider* iMusic;
|
|
124 |
RPointerArray <CContactInfo> iEntries;
|
|
125 |
RBuf8 iSrvName;
|
|
126 |
|
|
127 |
RBuf8 iPublishBaseUrl;
|
|
128 |
|
|
129 |
RBuf8 iBaseUrl;
|
|
130 |
RBuf8 iIconName;
|
|
131 |
RBuf8 iFileName;
|
|
132 |
RBuf8 iCurrentlyPlaying;
|
|
133 |
RBuf8 iContactName;
|
|
134 |
RBuf8 iStatus;
|
|
135 |
|
|
136 |
CContactInfo* iNewContact;
|
|
137 |
//@ TODO remove later
|
|
138 |
//TInt iCount;
|
|
139 |
//TBool isPresent;
|
|
140 |
|
|
141 |
|
|
142 |
QAction* shareAction;
|
|
143 |
QAction* unshareAction;
|
|
144 |
CHttpServer* iHttpServer;
|
|
145 |
//CHttpClient* iHttpClient;
|
|
146 |
TBool iStatusUpdate;
|
|
147 |
QFile iGenericFile;
|
|
148 |
QByteArray filename;
|
|
149 |
|
|
150 |
QNetworkAccessManager *manager;
|
|
151 |
QNetworkReply *reply;
|
|
152 |
QNetworkReply *itemReply;
|
|
153 |
QProgressDialog* progressBar;
|
|
154 |
|
|
155 |
//Flag to keep track whether to publish/ update service
|
|
156 |
TBool iUpdate;
|
|
157 |
//TBool IsDownloadItem;
|
|
158 |
|
|
159 |
//QNetworkAccessManager *manager;
|
|
160 |
//QNetworkReply *reply;
|
|
161 |
QFile MyStatusFile; //used for persistence storage of
|
|
162 |
//status string
|
|
163 |
QString nowStatus; //stores the current status of string
|
|
164 |
|
|
165 |
QFile logFile;
|
|
166 |
private slots:
|
|
167 |
void on_pushBackFile_clicked();
|
|
168 |
void on_pushBackChat_clicked();
|
|
169 |
void on_pushBackVideo_clicked();
|
|
170 |
void on_pushBackMusic_clicked();
|
|
171 |
void on_pushBackContact_clicked();
|
|
172 |
void on_listAvatars_itemClicked(QListWidgetItem* item);
|
|
173 |
void RequestFinished();
|
|
174 |
void ItemRequestFinished();
|
|
175 |
void StartServer();
|
|
176 |
void backPressed();
|
|
177 |
void StopServer();
|
|
178 |
void ContactitemClicked(QTreeWidgetItem* item, int column);
|
|
179 |
void ProgressBarCanceled();
|
|
180 |
void UpdateMyStatus();
|
|
181 |
|
|
182 |
};
|
|
183 |
|
|
184 |
#endif // ZEROCONFSHARINGUI_H
|