From 46061aa2dbc20edcf98f26dfff5f8c23fcaae4eb Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 16 Mar 2011 20:13:40 +0100 Subject: (WIP) logViewer wont stay like this, just to show layout possibilities..(WIP) logViewer wont stay like this, just to show layout possibilities.... --- src/downloadManager.cpp | 2 +- src/fbgui.cpp | 48 +++++++++++++++++++++++------------------------- src/fbgui.h | 7 ------- src/logViewer.cpp | 5 +++-- 4 files changed, 27 insertions(+), 35 deletions(-) diff --git a/src/downloadManager.cpp b/src/downloadManager.cpp index 1271a8c..01769ef 100644 --- a/src/downloadManager.cpp +++ b/src/downloadManager.cpp @@ -7,7 +7,7 @@ int downloadManager::downloaded = 0; // ---------------------------------------------------------------------------------------- downloadManager::downloadManager() { - logView->write(QString("testing @ DM init")); + //logView->write(QString("testing @ DM init")); qnam = new QNetworkAccessManager(); dip = false; downloadDir = QDir(downloadPath); 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 #include #include -#include -// 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 { diff --git a/src/fbgui.h b/src/fbgui.h index c0ef95e..b62e5ab 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -33,7 +33,6 @@ extern QString downloadPath; extern QUrl baseURL; extern bool debug; extern int updateInterval; -extern logViewer *logView; class fbgui : public QMainWindow { @@ -41,16 +40,10 @@ class fbgui : public QMainWindow public: fbgui(); - /* public log access */ - //void log(QString text); private: void checkHost() const; - QWebView *webView; - -protected: - void keyPressEvent(QKeyEvent *event); }; #endif // FBGUI_H diff --git a/src/logViewer.cpp b/src/logViewer.cpp index 2c302f8..4f2b42d 100644 --- a/src/logViewer.cpp +++ b/src/logViewer.cpp @@ -2,13 +2,14 @@ #include logViewer::logViewer(QWidget *parent) : QTextEdit(parent) { + setWindowFlags(Qt::FramelessWindowHint); QPalette qp; qp.setColor(QPalette::Base, Qt::black); setPalette(qp); setTextColor(Qt::green); setPlainText("Debug console loaded."); - resize(QSize(640, 480)); - setVisible(false); + //resize(QSize(640, 480)); + //setVisible(false); } void logViewer::write(QString text){ -- cgit v1.2.3-55-g7522