summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-16 16:08:47 +0100
committerJonathan Bauer2011-03-16 16:08:47 +0100
commit5804b7b2d9dcc79fb8f1bdb1af52d39fc6712318 (patch)
treec50746061d4b126aba9d936b935d13613d7c84af /src
parentfix (diff)
downloadfbgui-5804b7b2d9dcc79fb8f1bdb1af52d39fc6712318.tar.gz
fbgui-5804b7b2d9dcc79fb8f1bdb1af52d39fc6712318.tar.xz
fbgui-5804b7b2d9dcc79fb8f1bdb1af52d39fc6712318.zip
logView now global, write(QString text) public function for appending text.
Diffstat (limited to 'src')
-rw-r--r--src/downloadManager.cpp2
-rw-r--r--src/fbgui.cpp7
-rw-r--r--src/fbgui.h4
-rw-r--r--src/logViewer.cpp7
-rw-r--r--src/logViewer.h2
5 files changed, 12 insertions, 10 deletions
diff --git a/src/downloadManager.cpp b/src/downloadManager.cpp
index 83f02be..1271a8c 100644
--- a/src/downloadManager.cpp
+++ b/src/downloadManager.cpp
@@ -7,7 +7,7 @@ int downloadManager::downloaded = 0;
// ----------------------------------------------------------------------------------------
downloadManager::downloadManager()
{
- //fbgui::log(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 5b15666..8f738d3 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -15,13 +15,14 @@ QString downloadPath(binPath + "/downloads");
QUrl baseURL(DEFAULT_URL);
bool debug = false;
int updateInterval = DEFAULT_UPDATE_INTERVAL;
+logViewer *logView;
//-------------------------------------------------------------------------------------------
fbgui::fbgui()
{
/* debug console test */
if (debug) logView = new logViewer(this);
-
+ logView->write("fbgui initialization...");
/* initialize "browser" */
checkHost();
webView = new QWebView(this);
@@ -64,10 +65,6 @@ 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 f747fd3..c0ef95e 100644
--- a/src/fbgui.h
+++ b/src/fbgui.h
@@ -33,6 +33,7 @@ extern QString downloadPath;
extern QUrl baseURL;
extern bool debug;
extern int updateInterval;
+extern logViewer *logView;
class fbgui : public QMainWindow
{
@@ -41,11 +42,10 @@ class fbgui : public QMainWindow
public:
fbgui();
/* public log access */
- void log(QString text);
+ //void log(QString text);
private:
void checkHost() const;
- logViewer *logView;
QWebView *webView;
diff --git a/src/logViewer.cpp b/src/logViewer.cpp
index 59e091e..2c302f8 100644
--- a/src/logViewer.cpp
+++ b/src/logViewer.cpp
@@ -1,11 +1,16 @@
#include <logViewer.h>
+#include <fbgui.h>
logViewer::logViewer(QWidget *parent) : QTextEdit(parent) {
QPalette qp;
qp.setColor(QPalette::Base, Qt::black);
setPalette(qp);
setTextColor(Qt::green);
- setPlainText("empty console.");
+ setPlainText("Debug console loaded.");
resize(QSize(640, 480));
setVisible(false);
}
+
+void logViewer::write(QString text){
+ if (debug) this->append(text);
+}
diff --git a/src/logViewer.h b/src/logViewer.h
index 5c32093..7c61baf 100644
--- a/src/logViewer.h
+++ b/src/logViewer.h
@@ -23,7 +23,7 @@ class logViewer : public QTextEdit {
public:
logViewer(QWidget *parent);
-
+ void write(QString text);
};
#endif // LOGVIEWER_H