diff options
author | adelcastillo <adelcastillo@us.es> | 2009-11-02 22:13:34 +0000 |
---|---|---|
committer | adelcastillo <adelcastillo@us.es> | 2009-11-02 22:13:34 +0000 |
commit | cb57eebd5dcb1e718f828dc1b71fc507b3cf9622 (patch) | |
tree | dbf672f74cecead8ecc89214460ab6c26759fae3 /client/browser | |
parent | 749e6b56dca024028e6bcfe2430de303074975bc (diff) |
Barra de direcciones completada.
git-svn-id: https://opengnsys.es/svn/trunk@475 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/browser')
-rw-r--r-- | client/browser/CMakeLists.txt | 2 | ||||
-rw-r--r-- | client/browser/mainwindow.cpp | 61 | ||||
-rw-r--r-- | client/browser/mainwindow.h | 7 |
3 files changed, 63 insertions, 7 deletions
diff --git a/client/browser/CMakeLists.txt b/client/browser/CMakeLists.txt index 0648bdbe..c2f66778 100644 --- a/client/browser/CMakeLists.txt +++ b/client/browser/CMakeLists.txt @@ -29,6 +29,8 @@ add_executable(browser ${browser_SRCS}) target_link_libraries(browser qtermwidget ${QT_QTWEBKIT_LIBRARIES} ) +# set(CMAKE_CXX_FLAGS "-static") + foreach(QT ${QT_LIBRARIES}) message("${QT}") endforeach(QT) diff --git a/client/browser/mainwindow.cpp b/client/browser/mainwindow.cpp index c528f949..0162305d 100644 --- a/client/browser/mainwindow.cpp +++ b/client/browser/mainwindow.cpp @@ -12,6 +12,7 @@ #include <QDateTime> #include <QProgressBar> #include <QTabWidget> +#include <QLineEdit> #include "qtermwidget.h" @@ -36,7 +37,7 @@ MainWindow::MainWindow(QWidget *parent) // Output output->setReadOnly(true); - // Dock + // Button Dock QDockWidget* dock=new QDockWidget(); dock->setAllowedAreas(Qt::BottomDockWidgetArea); QWidget* dummy=new QWidget(); @@ -46,7 +47,9 @@ MainWindow::MainWindow(QWidget *parent) // TabWidget tabs=new QTabWidget(dock); QPushButton *button=new QPushButton(tr("&New Term")); + button->setFocusPolicy(Qt::TabFocus); tabs->setCornerWidget(button); + tabs->setFocusPolicy(Qt::NoFocus); tabs->addTab(output,tr("Output")); slotCreateTerminal(); @@ -57,6 +60,22 @@ MainWindow::MainWindow(QWidget *parent) // Y el dock al mainwindow addDockWidget(Qt::BottomDockWidgetArea,dock); + // Top Dock + dock=new QDockWidget(); + dock->setAllowedAreas(Qt::TopDockWidgetArea); + QWidget* dummy2=new QWidget(); + dummy2->setMaximumHeight(0); + dock->setTitleBarWidget(dummy2); + + // WebBar + webBar=new QLineEdit(dock); + + // WebBar al dock + dock->setWidget(webBar); + + // dock al mainwindow + addDockWidget(Qt::TopDockWidgetArea,dock); + // Status bar QStatusBar* st=statusBar(); st->setSizeGripEnabled(false); @@ -67,15 +86,13 @@ MainWindow::MainWindow(QWidget *parent) web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); // Web signals - connect(web->page(),SIGNAL(linkClicked(const QUrl&)),this, + connect(web,SIGNAL(linkClicked(const QUrl&)),this, SLOT(slotLinkHandle(const QUrl&))); connect(web,SIGNAL(loadStarted()),this,SLOT(slotWebLoadStarted())); connect(web,SIGNAL(loadFinished(bool)),this,SLOT(slotWebLoadFinished(bool))); connect(web,SIGNAL(loadProgress(int)),this,SLOT(slotWebLoadProgress(int))); - - QStringList arguments=QCoreApplication::arguments(); - web->load(QUrl(arguments[1])); - + connect(web,SIGNAL(urlChanged(const QUrl&)),this, + SLOT(slotUrlChanged(const QUrl&))); // Process signals connect(process,SIGNAL(started()),this,SLOT(slotProcessStarted())); @@ -89,7 +106,9 @@ MainWindow::MainWindow(QWidget *parent) connect(process,SIGNAL(readyReadStandardError()), this,SLOT(slotProcessErrorOutput())); + // Dock signals connect(button,SIGNAL(clicked()),this,SLOT(slotCreateTerminal())); + connect(webBar,SIGNAL(returnPressed()),this,SLOT(slotWebBarReturnPressed())); if(!readEnvironmentValues()) output->insertPlainText(tr("Any environment variable/s didn't be setted\n")); @@ -107,6 +126,10 @@ MainWindow::MainWindow(QWidget *parent) else logstream=new QTextStream(logfile); } + + QStringList arguments=QCoreApplication::arguments(); + webBar->setText(arguments[1]); + web->load(QUrl(arguments[1])); } MainWindow::~MainWindow() @@ -201,6 +224,13 @@ void MainWindow::slotWebLoadFinished(bool ok) } } + +void MainWindow::slotUrlChanged(const QUrl &url) +{ + webBar->setText(url.toString()); + qDebug()<<"Change"<<endl; +} + void MainWindow::slotProcessStarted() { qDebug()<<"Proceso inicializado"<<endl; @@ -272,22 +302,39 @@ void MainWindow::slotProcessError(QProcess::ProcessError error) void MainWindow::slotCreateTerminal() { - QTermWidget* console = new QTermWidget(); + QTermWidget* console = new QTermWidget(1,this); QFont font = QApplication::font(); font.setFamily("Terminus"); font.setPointSize(12); console->setTerminalFont(font); + console->setFocusPolicy(Qt::StrongFocus); //console->setColorScheme(COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW); console->setScrollBarPosition(QTermWidget::ScrollBarRight); ++numberTerminal; + connect(console,SIGNAL(finished()),this,SLOT(slotDeleteTerminal())); + QString name=tr("Term ")+QString::number(numberTerminal); tabs->addTab(console,name); } +void MainWindow::slotDeleteTerminal() +{ + QWidget *widget = qobject_cast<QWidget *>(sender()); + Q_ASSERT(widget); + tabs->removeTab(tabs->indexOf(widget)); +} + +void MainWindow::slotWebBarReturnPressed() +{ + QUrl url(webBar->text()); + if(url.isValid()) + slotLinkHandle(url); +} + int MainWindow::readEnvironmentValues() { // The return value diff --git a/client/browser/mainwindow.h b/client/browser/mainwindow.h index 650aec3c..9f4a14da 100644 --- a/client/browser/mainwindow.h +++ b/client/browser/mainwindow.h @@ -21,6 +21,7 @@ class QFile; class QTextStream; class QTermWidget; class QProgressBar; +class QLineEdit; class MainWindow : public QMainWindow { @@ -46,6 +47,11 @@ class MainWindow : public QMainWindow // Funcion para crear terminales void slotCreateTerminal(); + void slotDeleteTerminal(); + + // Funcion para el webar + void slotWebBarReturnPressed(); + void slotUrlChanged(const QUrl &url); //Functions protected: @@ -57,6 +63,7 @@ class MainWindow : public QMainWindow QTextEdit *output; QProgressBar *progressBar; QTabWidget *tabs; + QLineEdit *webBar; QProcess *process; |