Fork me on GitHub
2.15.20
FGx
A cross-platform launcher for FlightGear
xbrowser.cpp
Go to the documentation of this file.
1 
2 #include <QToolBar>
3 
4 
5 #include "xbrowser.h"
6 
8  QWidget(parent)
9 {
10 
11  mainObject = mob;
12 
13  QVBoxLayout *mainLayout = new QVBoxLayout(this);
14  mainLayout->setContentsMargins(0,0,0,0);
15  mainLayout->setSpacing(0);
16 
17 
18  QToolBar *toolbar = new QToolBar();
19  mainLayout->addWidget(toolbar, 0);
20 
21 
22 
23  //== Browser storage
24  //** TODO check this works? roblem with usign cache first ????
25  networkDiskCache = new QNetworkDiskCache(this);
26  networkDiskCache->setCacheDirectory(XSettings::cache_dir());
27 
28  networkCookieJar = new QNetworkCookieJar(this);
29 
30  //== WebView
31  webView = new QWebView();
32  mainLayout->addWidget(webView);
33 
34  webView->page()->mainFrame()->addToJavaScriptWindowObject("QtWidget", this);
35  connect(webView, SIGNAL(loadStarted()),
36  this, SLOT(progress_start())
37  );
38  connect(webView, SIGNAL(loadProgress(int)),
39  this, SLOT(progress_update(int))
40  );
41  connect(webView, SIGNAL(loadFinished(bool)),
42  this, SLOT(progress_finish(bool)));
43 
44  //*********************************
45  //** Status Bar
46  statusBar = new QStatusBar();
47  mainLayout->addWidget(statusBar);
48 
49  statusBar->addPermanentWidget(new QLabel("Zoom:"));
50  //lblZoom = new QLabel("-");
51  //statusBar->addPermanentWidget(lblZoom);
52 
53 
54 }
55 
56 
57 
58 //==========================================
59 //== Progress Slots
60 //==========================================
62  progressBar->setVisible(true);
63 }
64 
66  progressBar->setValue(v);
67 }
69  Q_UNUSED(Ok);
70  progressBar->setVisible(false);
71  //statusBar->showMessage( comboServer->itemData(comboServer->currentIndex()).toString() );
72 }
73 
QProgressBar * progressBar
Definition: xbrowser.h:31
The MainObject is an extended QObject, and the main "controller" for FGx.
Definition: mainobject.h:66
QToolBar * toolbar
Definition: xbrowser.h:29
void progress_update(int progress)
Definition: xbrowser.cpp:65
QStatusBar * statusBar
Definition: xbrowser.h:37
void progress_finish(bool Ok)
Definition: xbrowser.cpp:68
XBrowser(MainObject *mob, QWidget *parent=0)
Definition: xbrowser.cpp:7
QNetworkDiskCache * networkDiskCache
Definition: xbrowser.h:34
static QString cache_dir()
shortcut to cache directory
Definition: xsettings.cpp:152
QWebView * webView
Definition: xbrowser.h:33
QNetworkCookieJar * networkCookieJar
Definition: xbrowser.h:35
MainObject * mainObject
Definition: xbrowser.h:27
void progress_start()
Definition: xbrowser.cpp:61