diff options
Diffstat (limited to 'src/fbgui.cpp')
| -rw-r--r-- | src/fbgui.cpp | 48 |
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 { |
