summaryrefslogtreecommitdiffstats
path: root/src/fbgui.cpp
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-16 20:13:40 +0100
committerJonathan Bauer2011-03-16 20:13:40 +0100
commit46061aa2dbc20edcf98f26dfff5f8c23fcaae4eb (patch)
tree45d3b6c2dc44203633d9b3cb5ea0bb703c6892bf /src/fbgui.cpp
parentlogView now global, write(QString text) public function for appending text. (diff)
downloadfbgui-46061aa2dbc20edcf98f26dfff5f8c23fcaae4eb.tar.gz
fbgui-46061aa2dbc20edcf98f26dfff5f8c23fcaae4eb.tar.xz
fbgui-46061aa2dbc20edcf98f26dfff5f8c23fcaae4eb.zip
(WIP) logViewer wont stay like this, just to show layout possibilities..(WIP) logViewer wont stay like this, just to show layout possibilities....
Diffstat (limited to 'src/fbgui.cpp')
-rw-r--r--src/fbgui.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index 8f738d3..9bde450 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -7,33 +7,45 @@
#include <QDir>
#include <QHostInfo>
#include <QtWebKit>
-#include <QPlainTextEdit>
-// Note: Absolute paths. binPath empty init, set in main() after QApplication instanciated.
+QUrl baseURL(DEFAULT_URL);
QString binPath("");
QString downloadPath(binPath + "/downloads");
-QUrl baseURL(DEFAULT_URL);
-bool debug = false;
int updateInterval = DEFAULT_UPDATE_INTERVAL;
-logViewer *logView;
+bool debug = false;
//-------------------------------------------------------------------------------------------
fbgui::fbgui()
{
- /* debug console test */
- if (debug) logView = new logViewer(this);
- logView->write("fbgui initialization...");
+ /* debug console tests */
+ logViewer *logView = new logViewer(this);
+ /* dock on bottom */
+ QDockWidget *dw = new QDockWidget(QString("debug console"), this);
+ dw->setAllowedAreas(Qt::BottomDockWidgetArea);
+ dw->setWidget(logView);
+ addDockWidget(Qt::BottomDockWidgetArea, dw);
+ /* TEST
+ QWidget *dummy = new QWidget();
+ QVBoxLayout *layout = new QVBoxLayout();
+ layout->addWidget(webView);
+ layout->addWidget(logView);
+ dummy->setLayout(layout);
+ TEST */
+
+
+
+
/* initialize "browser" */
checkHost();
- webView = new QWebView(this);
+ QWebView *webView = new QWebView(this);
webView->load(baseURL);
/* initialize javascript interface */
javascriptInterface* jsi = new javascriptInterface(webView->page()->mainFrame());
QObject::connect(jsi, SIGNAL(quitFbgui()), this, SLOT(close()));
-
QObject::connect(webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
jsi, SLOT(attachToDOM()));
+
/* initialize download manager */
downloadManager* dm = new downloadManager();
QObject::connect(dm, SIGNAL(downloadInfo(QString, double)), jsi, SLOT(downloadInfo(QString, double)));
@@ -49,21 +61,7 @@ fbgui::fbgui()
showFullScreen();
show();
}
-//-------------------------------------------------------------------------------------------
-void fbgui::keyPressEvent(QKeyEvent *event){
- /* F4 toggles debug console */
- if (debug && event->key() == Qt::Key_F4){
- if (!logView->isVisible()){
- logView->append(QString("check passed."));
- logView->raise();
- logView->setVisible(true);
- }
- else {
- logView->lower();
- logView->setVisible(false);
- }
- }
-}
+
//-------------------------------------------------------------------------------------------
void fbgui::checkHost() const
{