summaryrefslogtreecommitdiffstats
path: root/src/fbgui.cpp
diff options
context:
space:
mode:
authorJonathan Bauer2011-03-21 10:51:51 +0100
committerJonathan Bauer2011-03-21 10:51:51 +0100
commit635b5c64f3107d4c01ae314fb75e02c571b51c54 (patch)
tree4d2a3a679a569f9133ca8d3d5f5159b393accde3 /src/fbgui.cpp
parentdebug modes. -D now needs an arg: 0 for regular terminal output, 1 for debug ... (diff)
downloadfbgui-635b5c64f3107d4c01ae314fb75e02c571b51c54.tar.gz
fbgui-635b5c64f3107d4c01ae314fb75e02c571b51c54.tar.xz
fbgui-635b5c64f3107d4c01ae314fb75e02c571b51c54.zip
transformed c syntax comments to c++ convention...
Diffstat (limited to 'src/fbgui.cpp')
-rw-r--r--src/fbgui.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/src/fbgui.cpp b/src/fbgui.cpp
index b4c55aa..e43d36e 100644
--- a/src/fbgui.cpp
+++ b/src/fbgui.cpp
@@ -14,9 +14,9 @@ int updateInterval = DEFAULT_UPDATE_INTERVAL;
int debugMode = -1;
//-------------------------------------------------------------------------------------------
-fbgui::fbgui(){
-
- /* setup basic debug */
+fbgui::fbgui()
+{
+ // setup basic debug
qxtLog->disableLoggerEngine("DEFAULT");
qxtLog->enableLogLevels(QxtLogger::DebugLevel);
if (debugMode == 0){
@@ -26,44 +26,45 @@ fbgui::fbgui(){
qxtLog->debug() << "Initializing fbgui...";
}
- /* base of the gui */
+ // base of the gui
createActions();
checkHost();
_webView = new QWebView(this);
_webView->load(baseURL);
- /* debug console split or normal browser */
+ // debug console split or normal browser
if (debugMode == 1)
setupDebugSplit();
else
setCentralWidget(_webView);
- /* initialize javascript interface */
+ // 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 */
+ // initialize download manager
downloadManager* dm = new downloadManager();
- QObject::connect(dm, SIGNAL(downloadInfo(QString, double)),
- jsi, SLOT(downloadInfo(QString, double)));
+ QObject::connect(dm, SIGNAL(downloadInfo(const QString&, const double&)),
+ jsi, SLOT(downloadInfo(const QString&, const double&)));
QObject::connect(dm, SIGNAL(notify(QString)),
jsi, SLOT(notify(QString)));
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(const int&, const double&, const QString&)),
+ jsi, SLOT(updateProgressBar(const int&, const double&, const QString&)));
QObject::connect(dm, SIGNAL(downloadQueueEmpty()), jsi, SLOT(callbackOnDlQueueFinished()));
- /* set properties */
+ // set properties
setWindowTitle("fbgui");
setAttribute(Qt::WA_QuitOnClose, true);
setWindowFlags(Qt::FramelessWindowHint);
showFullScreen();
}
//-------------------------------------------------------------------------------------------
-void fbgui::createActions(){
- /* CTRL + X to kill the gui */
+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);
@@ -71,7 +72,8 @@ void fbgui::createActions(){
}
//-------------------------------------------------------------------------------------------
-void fbgui::setupDebugSplit(){
+void fbgui::setupDebugSplit()
+{
_debugConsole = new QTextEdit(this);
_debugConsole->setWindowFlags(Qt::FramelessWindowHint);
QPalette pal;
@@ -79,15 +81,15 @@ void fbgui::setupDebugSplit(){
_debugConsole->setPalette(pal);
_debugConsole->setTextColor(Qt::cyan);
_debugConsole->insertPlainText("Debug console initialized.\n");
- /* enable custom logger engine */
+ // enable custom logger engine
qxtLog->addLoggerEngine("fb_logger", new loggerEngine_fb(_debugConsole));
qxtLog->initLoggerEngine("fb_logger");
qxtLog->setMinimumLevel("fb_logger", QxtLogger::DebugLevel);
- /* display browser and debug in a splitter */
+ // display browser and debug in a splitter
_splitter = new QSplitter(Qt::Vertical, this);
_splitter->addWidget(_webView);
_splitter->addWidget(_debugConsole);
- /* CTRL + D toggles debug window */
+ // CTRL + D toggles debug window
_toggleDebug = new QAction(tr("&toggleDebug"), this);
_toggleDebug->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
addAction(_toggleDebug);
@@ -95,14 +97,16 @@ void fbgui::setupDebugSplit(){
setCentralWidget(_splitter);
}
//-------------------------------------------------------------------------------------------
-void fbgui::toggleDebug(){
+void fbgui::toggleDebug()
+{
if (_debugConsole->isVisible())
_debugConsole->hide();
else
_debugConsole->show();
}
//-------------------------------------------------------------------------------------------
-void fbgui::checkHost() const{
+void fbgui::checkHost() const
+{
// TODO instead of closing app, show error page from qrc
QHostInfo hostInfo = QHostInfo::fromName(baseURL.host());
if (hostInfo.error() != QHostInfo::NoError){