summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Ruei2016-06-12 14:38:08 -0500
committerEric Ruei2016-06-12 14:38:08 -0500
commit78ad5db716d1abc4c05abfe435f066b6b88454d5 (patch)
treedfd77789fb21230bcb56e89cdbf7416ac4cc2903
parent5ab1350db5892f1fec9995b53670f27977c69f8d (diff)
downloadmatrix_browser-78ad5db716d1abc4c05abfe435f066b6b88454d5.tar.gz
matrix_browser-78ad5db716d1abc4c05abfe435f066b6b88454d5.tar.xz
matrix_browser-78ad5db716d1abc4c05abfe435f066b6b88454d5.zip
MatrixWebView.h MatrixWebView.cpp main.cpp: Replace QWebView with QMainWindow as top-layer display window
This change is made to resolve the issue that QWebView.showFullScreen() does not work in QPA Linuxfb Signed-off-by: Eric Ruei <e-ruei1@ti.com>
-rw-r--r--MatrixWebView.cpp10
-rw-r--r--MatrixWebView.h7
-rwxr-xr-xmain.cpp9
3 files changed, 16 insertions, 10 deletions
diff --git a/MatrixWebView.cpp b/MatrixWebView.cpp
index 8126d65..48459b7 100644
--- a/MatrixWebView.cpp
+++ b/MatrixWebView.cpp
@@ -37,6 +37,9 @@
37 * 37 *
38*/ 38*/
39 39
40#include <QtWidgets>
41#include <QtNetwork>
42#include <QtWebKitWidgets>
40#include "MatrixWebView.h" 43#include "MatrixWebView.h"
41#include <sys/types.h> 44#include <sys/types.h>
42#include <sys/socket.h> 45#include <sys/socket.h>
@@ -45,12 +48,15 @@
45 48
46int MatrixWebView::sigtermFd[2]; 49int MatrixWebView::sigtermFd[2];
47 50
48MatrixWebView::MatrixWebView(QWidget* parent) 51MatrixWebView::MatrixWebView(const QUrl& url)
49 : QWebView(parent)
50{ 52{
51 if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigtermFd)) 53 if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigtermFd))
52 qFatal("Couldn't create TERM socketpair"); 54 qFatal("Couldn't create TERM socketpair");
53 55
56 view = new QWebView(this);
57 view->load(url);
58 setCentralWidget(view);
59
54 snTerm = new QSocketNotifier(sigtermFd[1], QSocketNotifier::Read, this); 60 snTerm = new QSocketNotifier(sigtermFd[1], QSocketNotifier::Read, this);
55 connect(snTerm, SIGNAL(activated(int)), this, SLOT(handleSigTerm())); 61 connect(snTerm, SIGNAL(activated(int)), this, SLOT(handleSigTerm()));
56} 62}
diff --git a/MatrixWebView.h b/MatrixWebView.h
index 4944e7f..fec7249 100644
--- a/MatrixWebView.h
+++ b/MatrixWebView.h
@@ -39,16 +39,18 @@
39#ifndef MATRIXWEBVIEW_H 39#ifndef MATRIXWEBVIEW_H
40#define MATRIXWEBVIEW_H 40#define MATRIXWEBVIEW_H
41 41
42#include <QtWidgets>
42#include <QWebView> 43#include <QWebView>
43#include <QGraphicsWebView> 44#include <QGraphicsWebView>
44#include <QSocketNotifier> 45#include <QSocketNotifier>
46#include <QMainWindow>
45 47
46class MatrixWebView : public QWebView 48class MatrixWebView : public QMainWindow
47{ 49{
48 Q_OBJECT 50 Q_OBJECT
49 51
50public: 52public:
51 MatrixWebView(QWidget* parent = 0); 53 MatrixWebView(const QUrl& url);
52 54
53 //Unix signal handler 55 //Unix signal handler
54 static void termSignalHandler(int unused); 56 static void termSignalHandler(int unused);
@@ -60,6 +62,7 @@ public slots:
60private: 62private:
61 static int sigtermFd[2]; 63 static int sigtermFd[2];
62 QSocketNotifier *snTerm; 64 QSocketNotifier *snTerm;
65 QWebView *view;
63}; 66};
64 67
65#endif 68#endif
diff --git a/main.cpp b/main.cpp
index 9eedaf5..a1ccd80 100755
--- a/main.cpp
+++ b/main.cpp
@@ -71,17 +71,14 @@ int main(int argc, char **argv)
71 71
72 bool windowed = QApplication::arguments().contains("--windowed"); 72 bool windowed = QApplication::arguments().contains("--windowed");
73 73
74 MatrixWebView view; 74 MatrixWebView* windowView = new MatrixWebView(QUrl(args[1]));
75 view.load(QUrl(args[1]));
76 view.setContextMenuPolicy(Qt::NoContextMenu);
77 75
78 if ( !windowed ) 76 if ( !windowed )
79 { 77 {
80 view.setWindowFlags(Qt::FramelessWindowHint); 78 windowView->showFullScreen();
81 view.showFullScreen();
82 } 79 }
83 else 80 else
84 view.show(); 81 windowView->show();
85 82
86 int ret = setup_unix_signal_handlers(); 83 int ret = setup_unix_signal_handlers();
87 if ( ret != 0 ) 84 if ( ret != 0 )