|
a/dirbrowser/cdbrowser.h |
|
b/dirbrowser/cdbrowser.h |
|
... |
|
... |
16 |
*/
|
16 |
*/
|
17 |
|
17 |
|
18 |
#ifndef _CDBROWSER_H_INCLUDED_
|
18 |
#ifndef _CDBROWSER_H_INCLUDED_
|
19 |
#define _CDBROWSER_H_INCLUDED_
|
19 |
#define _CDBROWSER_H_INCLUDED_
|
20 |
|
20 |
|
|
|
21 |
/** CDBrowser displays Content Directory data inside a DirBrowser Tab */
|
|
|
22 |
#include <time.h>
|
|
|
23 |
|
21 |
#include <vector>
|
24 |
#include <vector>
|
22 |
#include <iostream>
|
25 |
#include <iostream>
|
23 |
#include "libupnpp/config.h"
|
26 |
#include "libupnpp/config.h"
|
24 |
#include <set>
|
27 |
#include <set>
|
25 |
|
28 |
|
|
|
29 |
#ifdef USING_WEBENGINE
|
|
|
30 |
#include <QWebEngineView>
|
|
|
31 |
#define QWebView QWebEngineView
|
|
|
32 |
#define QWebPage QWebEnginePage
|
|
|
33 |
#define QWebSettings QWebEngineSettings
|
|
|
34 |
#else
|
26 |
#include <QWebView>
|
35 |
#include <QWebView>
|
|
|
36 |
#endif
|
|
|
37 |
|
27 |
#include <QVariant>
|
38 |
#include <QVariant>
|
28 |
#include <QTimer>
|
39 |
#include <QTimer>
|
29 |
#include <QPoint>
|
40 |
#include <QPoint>
|
30 |
#include <QMouseEvent>
|
41 |
#include <QMouseEvent>
|
31 |
|
42 |
|
|
... |
|
... |
34 |
#include "libupnpp/control/cdirectory.hxx"
|
45 |
#include "libupnpp/control/cdirectory.hxx"
|
35 |
|
46 |
|
36 |
#include "HelperStructs/MetaData.h"
|
47 |
#include "HelperStructs/MetaData.h"
|
37 |
#include "HelperStructs/globals.h"
|
48 |
#include "HelperStructs/globals.h"
|
38 |
|
49 |
|
|
|
50 |
#include "randplayer.h"
|
|
|
51 |
|
39 |
class ContentDirectoryQO;
|
52 |
class ContentDirectoryQO;
|
40 |
class RecursiveReaper;
|
53 |
class RecursiveReaper;
|
41 |
class DirBrowser;
|
54 |
class DirBrowser;
|
|
|
55 |
class QProgressDialog;
|
42 |
|
56 |
|
43 |
class CDBrowser : public QWebView
|
57 |
class CDBrowser : public QWebView
|
44 |
{
|
58 |
{
|
45 |
Q_OBJECT;
|
59 |
Q_OBJECT;
|
46 |
|
60 |
|
|
... |
|
... |
70 |
void onBrowseDone(int);
|
84 |
void onBrowseDone(int);
|
71 |
void onSliceAvailable(UPnPClient::UPnPDirContent *);
|
85 |
void onSliceAvailable(UPnPClient::UPnPDirContent *);
|
72 |
void onReaperSliceAvailable(UPnPClient::UPnPDirContent *);
|
86 |
void onReaperSliceAvailable(UPnPClient::UPnPDirContent *);
|
73 |
void setStyleSheet(bool);
|
87 |
void setStyleSheet(bool);
|
74 |
void refresh();
|
88 |
void refresh();
|
|
|
89 |
|
75 |
signals:
|
90 |
signals:
|
76 |
void sig_tracks_to_playlist(const MetaDataList&);
|
91 |
void sig_tracks_to_playlist(const MetaDataList&);
|
|
|
92 |
void sig_tracks_to_randplay(RandPlayer::PlayMode,
|
|
|
93 |
const std::vector<UPnPClient::UPnPDirObject>&);
|
77 |
void sig_now_in(QWidget *, const QString&);
|
94 |
void sig_now_in(QWidget *, const QString&);
|
78 |
void sig_searchcaps_changed();
|
95 |
void sig_searchcaps_changed();
|
79 |
void sig_browse_in_new_tab(QString UDN,
|
96 |
void sig_browse_in_new_tab(QString UDN,
|
80 |
std::vector<CDBrowser::CtPathElt>);
|
97 |
std::vector<CDBrowser::CtPathElt>);
|
81 |
|
98 |
void sig_rand_stop();
|
82 |
protected slots:
|
99 |
|
|
|
100 |
public slots:
|
83 |
virtual void appendHtml(const QString&, const QString& html);
|
101 |
virtual void appendHtml(const QString&, const QString& html);
|
84 |
virtual void onLinkClicked(const QUrl &);
|
102 |
virtual void onLinkClicked(const QUrl &);
|
85 |
virtual void createPopupMenu(const QPoint&);
|
103 |
virtual void createPopupMenu(const QPoint&);
|
86 |
virtual void simpleAdd(QAction *);
|
104 |
virtual void simpleAdd(QAction *);
|
87 |
virtual void recursiveAdd(QAction *);
|
105 |
virtual void recursiveAdd(QAction *);
|
|
... |
|
... |
95 |
void initContainerHtml(const std::string& ss=string());
|
113 |
void initContainerHtml(const std::string& ss=string());
|
96 |
void browseContainer(std::string, std::string, QPoint scrollpos = QPoint());
|
114 |
void browseContainer(std::string, std::string, QPoint scrollpos = QPoint());
|
97 |
void search(const string& objid, const string& iss, QPoint scrollpos =
|
115 |
void search(const string& objid, const string& iss, QPoint scrollpos =
|
98 |
QPoint());
|
116 |
QPoint());
|
99 |
void curpathClicked(unsigned int i);
|
117 |
void curpathClicked(unsigned int i);
|
|
|
118 |
void waitForPage();
|
100 |
|
119 |
|
101 |
// When displaying the servers list, we periodically check the
|
120 |
// When displaying the servers list, we periodically check the
|
102 |
// server pool state. The last seen Media Server descriptions are
|
121 |
// server pool state. The last seen Media Server descriptions are
|
103 |
// stored in m_msdescs for diffing with the new ones and deciding
|
122 |
// stored in m_msdescs for diffing with the new ones and deciding
|
104 |
// if we need to redraw. Timer and servers list are only used
|
123 |
// if we need to redraw. Timer and servers list are only used
|
|
... |
|
... |
118 |
// Threaded objects to perform directory reads and recursive walks
|
137 |
// Threaded objects to perform directory reads and recursive walks
|
119 |
ContentDirectoryQO *m_reader;
|
138 |
ContentDirectoryQO *m_reader;
|
120 |
RecursiveReaper *m_reaper;
|
139 |
RecursiveReaper *m_reaper;
|
121 |
void deleteReaders();
|
140 |
void deleteReaders();
|
122 |
|
141 |
|
|
|
142 |
// Busy dialog for lengthy ops
|
|
|
143 |
QProgressDialog *m_progressD;
|
|
|
144 |
time_t m_progstart;
|
|
|
145 |
|
123 |
// Content of the currently visited container or search
|
146 |
// Content of the currently visited container or search
|
124 |
std::vector<UPnPClient::UPnPDirObject> m_entries;
|
147 |
std::vector<UPnPClient::UPnPDirObject> m_entries;
|
125 |
// Scroll position to be restored when we're done reading. This is
|
148 |
// Scroll position to be restored when we're done reading. This is
|
126 |
// so that the user can scroll while we insert?
|
149 |
// so that the user can scroll while we insert?
|
127 |
QPoint m_savedscrollpos;
|
150 |
QPoint m_savedscrollpos;
|
|
... |
|
... |
168 |
return m_s;
|
191 |
return m_s;
|
169 |
}
|
192 |
}
|
170 |
QString m_s;
|
193 |
QString m_s;
|
171 |
};
|
194 |
};
|
172 |
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
#ifdef USING_WEBENGINE
|
|
|
199 |
|
|
|
200 |
class CDWebPage: public QWebEnginePage {
|
|
|
201 |
Q_OBJECT
|
|
|
202 |
|
|
|
203 |
public:
|
|
|
204 |
CDWebPage(CDBrowser *parent)
|
|
|
205 |
: QWebEnginePage((QWidget *)parent), m_browser(parent) {
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
protected:
|
|
|
209 |
|
|
|
210 |
virtual bool acceptNavigationRequest(const QUrl& url,
|
|
|
211 |
NavigationType,
|
|
|
212 |
bool) {
|
|
|
213 |
qDebug() << "acceptNavigationRequest: url: " << url.toString();
|
|
|
214 |
m_browser->onLinkClicked(url);
|
|
|
215 |
return false;
|
|
|
216 |
}
|
|
|
217 |
|
|
|
218 |
virtual void javaScriptConsoleMessage(
|
|
|
219 |
JavaScriptConsoleMessageLevel level,
|
|
|
220 |
const QString& msg, int lineNum, const QString & sourceID);
|
|
|
221 |
|
|
|
222 |
private:
|
|
|
223 |
CDBrowser *m_browser;
|
|
|
224 |
};
|
|
|
225 |
|
|
|
226 |
#define QWebView QWebEngineView
|
|
|
227 |
#define QWebPage QWebEnginePage
|
|
|
228 |
#define QWebSettings QWebEngineSettings
|
|
|
229 |
|
|
|
230 |
#else // Using Qt Webkit
|
|
|
231 |
|
|
|
232 |
// We only subclass QWebPage in order to display the JS error messages
|
|
|
233 |
class CDWebPage: public QWebPage {
|
|
|
234 |
Q_OBJECT;
|
|
|
235 |
|
|
|
236 |
public:
|
|
|
237 |
CDWebPage(QWidget* parent = 0) : QWebPage(parent) {
|
|
|
238 |
}
|
|
|
239 |
virtual void javaScriptConsoleMessage(const QString& msg, int lineNum,
|
|
|
240 |
const QString & sourceID);
|
|
|
241 |
};
|
|
|
242 |
|
|
|
243 |
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
|
|
244 |
#define SCRIPTOWNERSHIP QWebFrame::ScriptOwnership
|
|
|
245 |
#else
|
|
|
246 |
#define SCRIPTOWNERSHIP QScriptEngine::ScriptOwnership
|
|
|
247 |
#endif
|
|
|
248 |
|
|
|
249 |
#endif
|
|
|
250 |
|
173 |
#endif /* _CDBROWSER_H_INCLUDED_ */
|
251 |
#endif /* _CDBROWSER_H_INCLUDED_ */
|