Switch to unified view

a/dirbrowser/cdbrowser.h b/dirbrowser/cdbrowser.h
...
...
26
#include <iostream>
26
#include <iostream>
27
#include <unordered_set>
27
#include <unordered_set>
28
28
29
#ifdef USING_WEBENGINE
29
#ifdef USING_WEBENGINE
30
#include <QWebEngineView>
30
#include <QWebEngineView>
31
#define QWebView QWebEngineView
31
#define QWEBVIEW QWebEngineView
32
#define QWebPage QWebEnginePage
32
#define QWEBPAGE QWebEnginePage
33
#define QWebSettings QWebEngineSettings
33
#define QWEBSETTINGS QWebEngineSettings
34
#else
34
#else
35
#include <QWebView>
35
#include <QWebView>
36
#define QWEBVIEW QWebView
37
#define QWEBPAGE QWebPage
38
#define QWEBSETTINGS QWebSettings
36
#endif
39
#endif
37
40
38
#include <QVariant>
41
#include <QVariant>
39
#include <QTimer>
42
#include <QTimer>
40
#include <QPoint>
43
#include <QPoint>
...
...
53
class RecursiveReaper;
56
class RecursiveReaper;
54
class DirBrowser;
57
class DirBrowser;
55
class QProgressDialog;
58
class QProgressDialog;
56
class ContentDirectoryQO;
59
class ContentDirectoryQO;
57
60
58
class CDBrowser : public QWebView
61
class CDBrowser : public QWEBVIEW
59
{
62
{
60
    Q_OBJECT;
63
    Q_OBJECT;
61
64
62
 public:
65
 public:
63
    CDBrowser(QWidget* parent = 0);
66
    CDBrowser(QWidget* parent = 0);
...
...
98
    void sig_now_in(QWidget *, const QString&);
101
    void sig_now_in(QWidget *, const QString&);
99
    void sig_searchcaps_changed();
102
    void sig_searchcaps_changed();
100
    void sig_browse_in_new_tab(QString UDN,
103
    void sig_browse_in_new_tab(QString UDN,
101
                               std::vector<CDBrowser::CtPathElt>);
104
                               std::vector<CDBrowser::CtPathElt>);
102
    void sig_rand_stop();
105
    void sig_rand_stop();
103
                        
106
104
 public slots:
107
 public slots:
105
    virtual void appendHtml(const QString&, const QString& html);
108
    virtual void appendHtml(const QString&, const QString& html);
106
    virtual void onLinkClicked(const QUrl &);
109
    virtual void onLinkClicked(const QUrl &);
107
    virtual void createPopupMenu(const QPoint&);
110
    virtual void createPopupMenu(const QPoint&);
108
    virtual void simpleAdd(QAction *);
111
    virtual void simpleAdd(QAction *);
...
...
110
    virtual void back(QAction *);
113
    virtual void back(QAction *);
111
    virtual void rreaperDone(int);
114
    virtual void rreaperDone(int);
112
    virtual void onContentsSizeChanged(const QSize&);
115
    virtual void onContentsSizeChanged(const QSize&);
113
    virtual void mouseReleaseEvent(QMouseEvent *event);
116
    virtual void mouseReleaseEvent(QMouseEvent *event);
114
117
115
118
    virtual void onPopupJsDone(const QVariant&);
119
    virtual void onLoadFinished(bool);
120
    
116
 private:
121
 private:
117
    void initContainerHtml(const std::string& ss=string());
122
    void initContainerHtml(const std::string& ss=string());
118
    void browseContainer(std::string, std::string, QPoint scrollpos = QPoint());
123
    void browseContainer(std::string, std::string, QPoint scrollpos = QPoint());
119
    void search(const string& objid, const string& iss, QPoint scrollpos = 
124
    void search(const string& objid, const string& iss, QPoint scrollpos = 
120
                QPoint());
125
                QPoint());
121
    void curpathClicked(unsigned int i);
126
    void curpathClicked(unsigned int i);
122
    void waitForPage();
127
    void waitForPage();
123
128
    void mySetHtml(const QString&);
129
    void doCreatePopupMenu();
130
    
124
    // When displaying the servers list, we periodically check the
131
    // When displaying the servers list, we periodically check the
125
    // server pool state. The last seen Media Server descriptions are
132
    // server pool state. The last seen Media Server descriptions are
126
    // stored in m_msdescs for diffing with the new ones and deciding
133
    // stored in m_msdescs for diffing with the new ones and deciding
127
    // if we need to redraw. Timer and servers list are only used
134
    // if we need to redraw. Timer and servers list are only used
128
    // while we are displaying the servers page, the timer is stopped
135
    // while we are displaying the servers page, the timer is stopped
...
...
163
    DirBrowser *m_browsers;
170
    DirBrowser *m_browsers;
164
171
165
    // Objid and index in entries for the last popup menu click
172
    // Objid and index in entries for the last popup menu click
166
    std::string m_popupobjid;
173
    std::string m_popupobjid;
167
    std::string m_popupobjtitle;
174
    std::string m_popupobjtitle;
175
    std::string m_popupotype;
168
    int m_popupidx;
176
    int m_popupidx;
177
    QPoint m_popupos;
169
    int m_popupmode; // now, next, at end
178
    int m_popupmode; // now, next, at end
170
179
171
    // Remember last click kind for detecting midclick
180
    // Remember last click kind for detecting midclick
172
    Qt::MouseButton m_lastbutton;
181
    Qt::MouseButton m_lastbutton;
173
182
...
...
216
protected:
225
protected:
217
226
218
    virtual bool acceptNavigationRequest(const QUrl& url, 
227
    virtual bool acceptNavigationRequest(const QUrl& url, 
219
                                         NavigationType, 
228
                                         NavigationType, 
220
                                         bool) {
229
                                         bool) {
221
        qDebug() << "acceptNavigationRequest: url: " << url.toString();
222
        m_browser->onLinkClicked(url);
230
        m_browser->onLinkClicked(url);
223
        return false;
231
        return false;
224
    }
232
    }
225
233
226
    virtual void javaScriptConsoleMessage(
234
    virtual void javaScriptConsoleMessage(
...
...
228
        const QString& msg, int lineNum, const QString & sourceID);
236
        const QString& msg, int lineNum, const QString & sourceID);
229
237
230
private:
238
private:
231
    CDBrowser *m_browser;
239
    CDBrowser *m_browser;
232
};
240
};
233
234
#define QWebView QWebEngineView
235
#define QWebPage QWebEnginePage
236
#define QWebSettings QWebEngineSettings
237
241
238
#else // Using Qt Webkit
242
#else // Using Qt Webkit
239
243
240
// We only subclass QWebPage in order to display the JS error messages
244
// We only subclass QWebPage in order to display the JS error messages
241
class CDWebPage: public QWebPage {
245
class CDWebPage: public QWebPage {