summaryrefslogtreecommitdiffstats
path: root/src/fbgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fbgui.cpp')
-rw-r--r--src/fbgui.cpp40
1 files changed, 28 insertions, 12 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index f642da2..b4c55aa 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -11,26 +11,32 @@ QUrl baseURL(DEFAULT_URL);
QString binPath("");
QString downloadPath("/tmp/fbgui/downloads");
int updateInterval = DEFAULT_UPDATE_INTERVAL;
-bool debug = false;
-
+int debugMode = -1;
//-------------------------------------------------------------------------------------------
fbgui::fbgui(){
- /* setup qxt logger and enable custom std engine*/
+
+ /* setup basic debug */
qxtLog->disableLoggerEngine("DEFAULT");
- qxtLog->addLoggerEngine("std_logger", new loggerEngine_std);
- qxtLog->initLoggerEngine("std_logger");
- qxtLog->setMinimumLevel("std_logger", QxtLogger::DebugLevel);
- qxtLog->debug() << "Initializing fbgui...";
+ qxtLog->enableLogLevels(QxtLogger::DebugLevel);
+ if (debugMode == 0){
+ qxtLog->addLoggerEngine("std_logger", new loggerEngine_std);
+ qxtLog->initLoggerEngine("std_logger");
+ qxtLog->setMinimumLevel("std_logger", QxtLogger::DebugLevel);
+ qxtLog->debug() << "Initializing fbgui...";
+ }
- /* initliaze browser */
+ /* base of the gui */
+ createActions();
checkHost();
_webView = new QWebView(this);
_webView->load(baseURL);
- /* debug split if debug mode, normal browser else */
- if (debug) setupDebugSplit();
- else setCentralWidget(_webView);
+ /* debug console split or normal browser */
+ if (debugMode == 1)
+ setupDebugSplit();
+ else
+ setCentralWidget(_webView);
/* initialize javascript interface */
javascriptInterface* jsi = new javascriptInterface(_webView->page()->mainFrame());
@@ -49,12 +55,22 @@ fbgui::fbgui(){
jsi, SLOT(updateProgressBar(int, double, QString)));
QObject::connect(dm, SIGNAL(downloadQueueEmpty()), jsi, SLOT(callbackOnDlQueueFinished()));
+ /* set properties */
setWindowTitle("fbgui");
setAttribute(Qt::WA_QuitOnClose, true);
setWindowFlags(Qt::FramelessWindowHint);
showFullScreen();
}
//-------------------------------------------------------------------------------------------
+void fbgui::createActions(){
+ /* CTRL + X to kill the gui */
+ _quit = new QAction(tr("&quit"), this);
+ _quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
+ this->addAction(_quit);
+ connect(_quit, SIGNAL(triggered()), this, SLOT(close()));
+
+}
+//-------------------------------------------------------------------------------------------
void fbgui::setupDebugSplit(){
_debugConsole = new QTextEdit(this);
_debugConsole->setWindowFlags(Qt::FramelessWindowHint);
@@ -63,7 +79,7 @@ void fbgui::setupDebugSplit(){
_debugConsole->setPalette(pal);
_debugConsole->setTextColor(Qt::cyan);
_debugConsole->insertPlainText("Debug console initialized.\n");
- /* switch engine to custom engine class "logger" */
+ /* enable custom logger engine */
qxtLog->addLoggerEngine("fb_logger", new loggerEngine_fb(_debugConsole));
qxtLog->initLoggerEngine("fb_logger");
qxtLog->setMinimumLevel("fb_logger", QxtLogger::DebugLevel);