From 17fdd39dc2901a6b558f384621b6140c52e0525d Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 16 Mar 2011 14:27:21 +0100 Subject: fix --- src/downloadManager.cpp | 2 ++ src/fbgui.cpp | 23 ++++++++--------------- src/fbgui.h | 6 ++++-- 3 files changed, 14 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/downloadManager.cpp b/src/downloadManager.cpp index 039809a..83f02be 100644 --- a/src/downloadManager.cpp +++ b/src/downloadManager.cpp @@ -1,4 +1,5 @@ #include "downloadManager.h" +#include "fbgui.h" #include #include @@ -6,6 +7,7 @@ int downloadManager::downloaded = 0; // ---------------------------------------------------------------------------------------- downloadManager::downloadManager() { + //fbgui::log(QString("testing @ DM init")); qnam = new QNetworkAccessManager(); dip = false; downloadDir = QDir(downloadPath); diff --git a/src/fbgui.cpp b/src/fbgui.cpp index d062529..5b15666 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -15,23 +15,12 @@ QString downloadPath(binPath + "/downloads"); QUrl baseURL(DEFAULT_URL); bool debug = false; int updateInterval = DEFAULT_UPDATE_INTERVAL; + //------------------------------------------------------------------------------------------- fbgui::fbgui() { /* debug console test */ - if (debug){ - logView = new logViewer(this); - } - /* - logView = new QTextEdit(this); - logView->resize(QSize(640, 480)); - QPalette qp; - qp.setColor(QPalette::Base, Qt::black); - logView->setPalette(qp); - logView->setTextColor(Qt::green); - logView->setVisible(false); - logView->setPlainText("empty console."); - */ + if (debug) logView = new logViewer(this); /* initialize "browser" */ checkHost(); @@ -61,8 +50,8 @@ fbgui::fbgui() } //------------------------------------------------------------------------------------------- void fbgui::keyPressEvent(QKeyEvent *event){ - /* test */ - if (event->key() == Qt::Key_F4){ + /* F4 toggles debug console */ + if (debug && event->key() == Qt::Key_F4){ if (!logView->isVisible()){ logView->append(QString("check passed.")); logView->raise(); @@ -75,6 +64,10 @@ void fbgui::keyPressEvent(QKeyEvent *event){ } } //------------------------------------------------------------------------------------------- +void fbgui::log(QString text){ + this->logView->append(text); +} +//------------------------------------------------------------------------------------------- void fbgui::checkHost() const { QHostInfo hostInfo = QHostInfo::fromName(baseURL.host()); diff --git a/src/fbgui.h b/src/fbgui.h index 0bbe8ba..f747fd3 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -40,11 +40,13 @@ class fbgui : public QMainWindow public: fbgui(); + /* public log access */ + void log(QString text); private: - QWebView *webView; - logViewer *logView; void checkHost() const; + logViewer *logView; + QWebView *webView; protected: -- cgit v1.2.3-55-g7522