diff options
Diffstat (limited to 'src/fbgui.cpp')
-rw-r--r-- | src/fbgui.cpp | 44 |
1 files changed, 26 insertions, 18 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 { |