summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-18 11:31:51 +0100
committerJonathan Bauer2011-03-18 11:31:51 +0100
commitdb94cf6c69e5c8c9f2b1b5dcf77879c425fbd1b4 (patch)
treeb84360e117480587b99d6af0c1d02a0d6eaafe09 /src
parent(WIP) logViewer wont stay like this, just to show layout possibilities..(WIP)... (diff)
downloadfbgui-db94cf6c69e5c8c9f2b1b5dcf77879c425fbd1b4.tar.gz
fbgui-db94cf6c69e5c8c9f2b1b5dcf77879c425fbd1b4.tar.xz
fbgui-db94cf6c69e5c8c9f2b1b5dcf77879c425fbd1b4.zip
layout: logViewer as a bottom widget, resizeable, toggle with crtl + D, stil for demonstration purposes mostly...
Diffstat (limited to 'src')
-rw-r--r--src/fbgui.cpp44
-rw-r--r--src/fbgui.h6
-rw-r--r--src/logViewer.cpp14
-rw-r--r--src/logViewer.h4
4 files changed, 38 insertions, 30 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index 9bde450..52462cb 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -9,30 +9,26 @@
#include <QtWebKit>
QUrl baseURL(DEFAULT_URL);
-QString binPath("");
-QString downloadPath(binPath + "/downloads");
+QString binPath(QApplication::applicationDirPath());
+QString downloadPath("/tmp/fbgui/downloads");
int updateInterval = DEFAULT_UPDATE_INTERVAL;
bool debug = false;
//-------------------------------------------------------------------------------------------
fbgui::fbgui()
{
- /* debug console tests */
+ /* TEST CODE */
logViewer *logView = new logViewer(this);
- /* dock on bottom */
+ /* Dock widget to place logView on bottom */
QDockWidget *dw = new QDockWidget(QString("debug console"), this);
dw->setAllowedAreas(Qt::BottomDockWidgetArea);
dw->setWidget(logView);
+ /* Create toggle action (F4) and add to fbgui's action list */
+ QAction *toggleLog = dw->toggleViewAction();
+ toggleLog->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
+ this->addAction(toggleLog);
+ /* Dock logView to bottom */
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" */
@@ -48,20 +44,32 @@ fbgui::fbgui()
/* initialize download manager */
downloadManager* dm = new downloadManager();
- QObject::connect(dm, SIGNAL(downloadInfo(QString, double)), jsi, SLOT(downloadInfo(QString, double)));
+ QObject::connect(dm, SIGNAL(downloadInfo(QString, double)),
+ jsi, SLOT(downloadInfo(QString, double)));
QObject::connect(jsi, SIGNAL(requestFile(QString&)), dm, SLOT(downloadFile(QString&)));
- QObject::connect(dm, SIGNAL(updateProgress(int, double, QString)), jsi, SLOT(updateProgressBar(int, double, QString)));
+ QObject::connect(dm, SIGNAL(updateProgress(int, double, QString)),
+ jsi, SLOT(updateProgressBar(int, double, QString)));
QObject::connect(dm, SIGNAL(downloadQueueEmpty()), jsi, SLOT(callbackOnDlQueueFinished()));
+
setWindowTitle("fbgui");
setAttribute(Qt::WA_QuitOnClose, true);
setWindowFlags(Qt::FramelessWindowHint);
- resize(QSize(800, 600));
setCentralWidget(webView);
showFullScreen();
- show();
-}
+}
+//-------------------------------------------------------------------------------------------
+void fbgui::createActions(){
+ _act = new QAction(tr("&test"), this);
+ _act->setShortcut(QKeySequence(Qt::Key_F5));
+ this->addAction(_act);
+ connect(_act, SIGNAL(triggered()), this, SLOT(testAct()));
+}
+//-------------------------------------------------------------------------------------------
+void fbgui::testAct(){
+ qDebug() << "Action triggered!";
+}
//-------------------------------------------------------------------------------------------
void fbgui::checkHost() const
{
diff --git a/src/fbgui.h b/src/fbgui.h
index b62e5ab..fc9a86b 100644
--- a/src/fbgui.h
+++ b/src/fbgui.h
@@ -42,8 +42,14 @@ public:
fbgui();
private:
+ void createActions();
void checkHost() const;
+ QAction* _act;
+
+private slots:
+ void testAct();
+
};
#endif // FBGUI_H
diff --git a/src/logViewer.cpp b/src/logViewer.cpp
index 4f2b42d..ac93f39 100644
--- a/src/logViewer.cpp
+++ b/src/logViewer.cpp
@@ -3,15 +3,9 @@
logViewer::logViewer(QWidget *parent) : QTextEdit(parent) {
setWindowFlags(Qt::FramelessWindowHint);
- QPalette qp;
- qp.setColor(QPalette::Base, Qt::black);
- setPalette(qp);
+ QPalette pal;
+ pal.setColor(QPalette::Base, Qt::black);
+ setPalette(pal);
setTextColor(Qt::green);
- setPlainText("Debug console loaded.");
- //resize(QSize(640, 480));
- //setVisible(false);
-}
-
-void logViewer::write(QString text){
- if (debug) this->append(text);
+ setPlainText("Debug console initialized.");
}
diff --git a/src/logViewer.h b/src/logViewer.h
index 7c61baf..b123f05 100644
--- a/src/logViewer.h
+++ b/src/logViewer.h
@@ -11,7 +11,8 @@
# General information about OpenSLX can be found under http://openslx.org
#
#
-# Simple logfile viewer / debug console.
+# Simple log viewer. (experimental)
+# Requires: Logger engine (to implement)
#
*/
#ifndef LOGVIEWER_H
@@ -23,7 +24,6 @@ class logViewer : public QTextEdit {
public:
logViewer(QWidget *parent);
- void write(QString text);
};
#endif // LOGVIEWER_H