Ahora el browser tiene terminal y salida por pestanyas.
git-svn-id: https://opengnsys.es/svn/trunk@453 a21b9725-9963-47de-94b9-378ad31fedc9remotes/github/master
parent
050d67a7fc
commit
23de05d08c
|
@ -2,9 +2,22 @@ project(browser)
|
|||
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
find_package(Qt4 REQUIRED)
|
||||
|
||||
include_directories(qtermwidget/src/ ${QT_INCLUDES} ${QT_QTWEBKIT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
if(QTEMBEDDED)
|
||||
#set(QT_INCLUDES /usr/local/Trolltech/include/)
|
||||
find_library(QT_LIBRARY NAMES QtWebKit PATHS /usr/local/Trolltech/QtEmbedded-4.5.1/lib/)
|
||||
message("${QT_LIBRARY}")
|
||||
message("Embedded")
|
||||
|
||||
else(QTEMBEDDED)
|
||||
find_package(Qt4 REQUIRED)
|
||||
message("Normal")
|
||||
endif(QTEMBEDDED)
|
||||
|
||||
# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in about every subdir
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
include_directories(qtermwidget/src/ ${QT_INCLUDES} ${QT_QTWEBKIT_INCLUDE_DIR})
|
||||
|
||||
add_subdirectory(qtermwidget)
|
||||
|
||||
|
@ -14,4 +27,8 @@ qt4_automoc(${browser_SRCS})
|
|||
|
||||
add_executable(browser ${browser_SRCS})
|
||||
|
||||
target_link_libraries(browser qtermwidget ${QT_LIBRARIES} ${QT_QTWEBKIT_LIBRARIES} )
|
||||
target_link_libraries(browser qtermwidget ${QT_QTWEBKIT_LIBRARIES} )
|
||||
|
||||
foreach(QT ${QT_LIBRARIES})
|
||||
message("${QT}")
|
||||
endforeach(QT)
|
||||
|
|
111
mainwindow.cpp
111
mainwindow.cpp
|
@ -1,5 +1,4 @@
|
|||
#include "mainwindow.h"
|
||||
#include "mainwindow.moc"
|
||||
#include <QtWebKit>
|
||||
#include <QStringList>
|
||||
#include <QWebView>
|
||||
|
@ -11,42 +10,58 @@
|
|||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QDateTime>
|
||||
#include <QProgressBar>
|
||||
#include <QTabWidget>
|
||||
|
||||
#include "qtermwidget.h"
|
||||
|
||||
#include "mainwindow.moc"
|
||||
|
||||
#define BUFFERSIZE 2048
|
||||
|
||||
#define CURRENT_TIME() QDateTime::currentDateTime().toString("dd/MM/yy hh:mm:ss")
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent),web(new QWebView()),text(new QTextEdit()),
|
||||
: QMainWindow(parent),web(new QWebView()),output(new QTextEdit()),
|
||||
process(new QProcess(this)),
|
||||
logfile(NULL),logstream(NULL)
|
||||
{
|
||||
// Graphic
|
||||
setCentralWidget(web);
|
||||
|
||||
dock=new QDockWidget(this);
|
||||
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
||||
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
|
||||
console = new QTermWidget();
|
||||
|
||||
QFont font = QApplication::font();
|
||||
font.setFamily("Terminus");
|
||||
font.setPointSize(12);
|
||||
|
||||
console->setTerminalFont(font);
|
||||
|
||||
//console->setColorScheme(COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW);
|
||||
console->setScrollBarPosition(QTermWidget::ScrollBarRight);
|
||||
|
||||
//showFullScreen();
|
||||
|
||||
dock->setWidget(console);
|
||||
setWindowTitle(tr("OpenGNSys Browser"));
|
||||
|
||||
setCentralWidget(web);
|
||||
|
||||
// Output
|
||||
output->setReadOnly(true);
|
||||
|
||||
// Dock
|
||||
QDockWidget* dock=new QDockWidget();
|
||||
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
||||
QWidget* dummy=new QWidget();
|
||||
dummy->setMaximumHeight(0);
|
||||
dock->setTitleBarWidget(dummy);
|
||||
|
||||
// TabWidget
|
||||
tabs=new QTabWidget(dock);
|
||||
|
||||
// Anyado output a las pestanyas
|
||||
tabs->addTab(output,tr("Output"));
|
||||
tabs->addTab(createTerminal(),tr("Term 1"));
|
||||
|
||||
// Las pestanyas al dock
|
||||
dock->setWidget(tabs);
|
||||
|
||||
// Y el dock al mainwindow
|
||||
addDockWidget(Qt::BottomDockWidgetArea,dock);
|
||||
|
||||
text->setReadOnly(true);
|
||||
// Status bar
|
||||
QStatusBar* st=statusBar();
|
||||
st->setSizeGripEnabled(false);
|
||||
progressBar=new QProgressBar(this);
|
||||
progressBar->setMinimum(0);
|
||||
progressBar->setMaximum(100);
|
||||
|
||||
web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
|
||||
|
||||
|
@ -73,11 +88,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(process,SIGNAL(readyReadStandardError()),
|
||||
this,SLOT(slotProcessErrorOutput()));
|
||||
|
||||
// Set tittle
|
||||
setWindowTitle(tr("OpenGNSys Browser"));
|
||||
|
||||
if(!readEnvironmentValues())
|
||||
text->insertPlainText(tr("Any environment variable/s didn't be setted\n"));
|
||||
output->insertPlainText(tr("Any environment variable/s didn't be setted\n"));
|
||||
|
||||
if(env.contains("OGLOGFILE") && env["OGLOGFILE"]!="")
|
||||
{
|
||||
|
@ -85,7 +97,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
if(!logfile->open(QIODevice::WriteOnly | QIODevice::Text |
|
||||
QIODevice::Append))
|
||||
{
|
||||
text->insertPlainText(tr("The log file couldn't be opened: ")+logfile->fileName());
|
||||
output->insertPlainText(tr("The log file couldn't be opened: ")+logfile->fileName());
|
||||
delete logfile;
|
||||
logfile=NULL;
|
||||
}
|
||||
|
@ -107,6 +119,13 @@ MainWindow::~MainWindow()
|
|||
|
||||
void MainWindow::slotLinkHandle(const QUrl &url)
|
||||
{
|
||||
// Si ya hay un proceso ejectuandose
|
||||
if(process->state()!=QProcess::NotRunning)
|
||||
{
|
||||
output->insertPlainText(tr("There is a process running."));
|
||||
return;
|
||||
}
|
||||
|
||||
QString string = url.toString();
|
||||
qDebug() << string;
|
||||
// Si es un link del tipo PROTOCOL lo ejecutamos
|
||||
|
@ -129,11 +148,18 @@ void MainWindow::slotLinkHandle(const QUrl &url)
|
|||
|
||||
void MainWindow::slotWebLoadStarted()
|
||||
{
|
||||
QStatusBar* st=statusBar();
|
||||
st->clearMessage();
|
||||
st->addWidget(progressBar,100);
|
||||
progressBar->show();
|
||||
progressBar->setFormat("%p% Loading");
|
||||
|
||||
qDebug()<<"Empieza la carga de la web";
|
||||
}
|
||||
|
||||
void MainWindow::slotWebLoadProgress(int progress)
|
||||
{
|
||||
progressBar->setValue(progress);
|
||||
qDebug()<<"Progress "<<progress;
|
||||
}
|
||||
|
||||
|
@ -163,7 +189,13 @@ void MainWindow::slotWebLoadFinished(bool ok)
|
|||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Descarga finalizada satisfactoriamente";
|
||||
|
||||
QStatusBar* st=statusBar();
|
||||
st->removeWidget(progressBar);
|
||||
st->showMessage(tr("Ready"));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slotProcessStarted()
|
||||
|
@ -178,14 +210,13 @@ void MainWindow::slotProcessOutput()
|
|||
char buf[BUFFERSIZE];
|
||||
while((process->readLine(buf,BUFFERSIZE) > 0))
|
||||
{
|
||||
text->insertPlainText(buf);
|
||||
output->insertPlainText(buf);
|
||||
/*
|
||||
QString str="<b>";
|
||||
str+=buf;
|
||||
str+="</b>";
|
||||
text->insertHtml(str);
|
||||
output->insertHtml(str);
|
||||
*/
|
||||
output<<buf;
|
||||
if(logstream)
|
||||
*logstream<<CURRENT_TIME()<<": "<<buf;
|
||||
}
|
||||
|
@ -198,8 +229,9 @@ void MainWindow::slotProcessErrorOutput()
|
|||
char buf[BUFFERSIZE];
|
||||
while((process->readLine(buf,BUFFERSIZE) > 0))
|
||||
{
|
||||
text->insertPlainText(buf);
|
||||
errors<<buf;
|
||||
output->insertPlainText(buf);
|
||||
if(logstream)
|
||||
*logstream<<CURRENT_TIME()<<": "<<buf;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,13 +240,11 @@ void MainWindow::slotProcessFinished(int code,QProcess::ExitStatus status)
|
|||
if(status==QProcess::NormalExit)
|
||||
{
|
||||
qDebug()<<"Finished: "<<code<<" "<<status<<endl;
|
||||
qDebug()<<"OUTPUT:"<<endl<<output<<endl<<"ERROR:"<<endl<<errors<<endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Ha petado"<<endl;
|
||||
qDebug()<<"Finished: "<<code<<" "<<status<<endl;
|
||||
qDebug()<<"OUTPUT:"<<endl<<output<<endl<<"ERROR:"<<endl<<errors<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,3 +300,18 @@ int MainWindow::readEnvironmentValues()
|
|||
return ret;
|
||||
}
|
||||
|
||||
QTermWidget* MainWindow::createTerminal()
|
||||
{
|
||||
QTermWidget* console = new QTermWidget();
|
||||
QFont font = QApplication::font();
|
||||
font.setFamily("Terminus");
|
||||
font.setPointSize(12);
|
||||
|
||||
console->setTerminalFont(font);
|
||||
|
||||
//console->setColorScheme(COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW);
|
||||
console->setScrollBarPosition(QTermWidget::ScrollBarRight);
|
||||
|
||||
return console;
|
||||
}
|
||||
|
||||
|
|
11
mainwindow.h
11
mainwindow.h
|
@ -19,8 +19,8 @@ class QString;
|
|||
class QUrl;
|
||||
class QFile;
|
||||
class QTextStream;
|
||||
class QDockWidget;
|
||||
class QTermWidget;
|
||||
class QProgressBar;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
|
@ -47,17 +47,16 @@ class MainWindow : public QMainWindow
|
|||
//Functions
|
||||
protected:
|
||||
int readEnvironmentValues();
|
||||
QTermWidget* createTerminal();
|
||||
|
||||
|
||||
protected:
|
||||
QWebView *web;
|
||||
QTextEdit *text;
|
||||
QDockWidget *dock;
|
||||
QTermWidget *console;
|
||||
QTextEdit *output;
|
||||
QProgressBar *progressBar;
|
||||
QTabWidget *tabs;
|
||||
|
||||
QProcess *process;
|
||||
QStringList output;
|
||||
QStringList errors;
|
||||
|
||||
QMap<QString,QString> env;
|
||||
QFile *logfile;
|
||||
|
|
|
@ -2,8 +2,6 @@ add_definitions(-DHAVE_POSIX_OPENPT)
|
|||
|
||||
aux_source_directory(src qtermwidget_SRCS)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
qt4_automoc(${qtermwidget_SRCS})
|
||||
|
||||
add_library(qtermwidget STATIC ${qtermwidget_SRCS})
|
||||
|
|
17
src/main.cpp
17
src/main.cpp
|
@ -1,17 +0,0 @@
|
|||
#include <QtGui/QApplication>
|
||||
#include <stdio.h>
|
||||
#include "mainwindow.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if(argc<=1)
|
||||
{
|
||||
printf("Usage: %s http://siteweb.com/\n",argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
|
@ -1,279 +0,0 @@
|
|||
#include "mainwindow.h"
|
||||
#include "mainwindow.moc"
|
||||
#include <QtWebKit>
|
||||
#include <QStringList>
|
||||
#include <QWebView>
|
||||
#include <QDockWidget>
|
||||
#include <QtDebug>
|
||||
#include <QWebPage>
|
||||
#include <QProcess>
|
||||
#include <QTextEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QDateTime>
|
||||
|
||||
#define BUFFERSIZE 2048
|
||||
|
||||
#define CURRENT_TIME() QDateTime::currentDateTime().toString("dd/MM/yy hh:mm:ss")
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent),web(new QWebView()),text(new QTextEdit()),
|
||||
process(new QProcess(this)),
|
||||
logfile(NULL),logstream(NULL)
|
||||
{
|
||||
// Graphic
|
||||
//layout->addWidget(web);
|
||||
//layout->addWidget(text);
|
||||
//setLayout(layout);
|
||||
setCentralWidget(web);
|
||||
|
||||
dock=new QDockWidget(this);
|
||||
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
||||
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
dock->setWidget(text);
|
||||
addDockWidget(Qt::BottomDockWidgetArea,dock);
|
||||
|
||||
|
||||
/*
|
||||
QTermWidget *console = new QTermWidget();
|
||||
|
||||
QFont font = QApplication::font();
|
||||
font.setFamily("Terminus");
|
||||
font.setPointSize(12);
|
||||
|
||||
console->setTerminalFont(font);
|
||||
|
||||
//console->setColorScheme(COLOR_SCHEME_BLACK_ON_LIGHT_YELLOW);
|
||||
console->setScrollBarPosition(QTermWidget::ScrollBarRight);
|
||||
|
||||
mainWindow->setCentralWidget(console);
|
||||
mainWindow->resize(802, 610);
|
||||
|
||||
QObject::connect(console, SIGNAL(finished()), mainWindow, SLOT(close()));
|
||||
*/
|
||||
//showFullScreen();
|
||||
|
||||
text->setReadOnly(true);
|
||||
|
||||
web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
|
||||
|
||||
// Web signals
|
||||
connect(web->page(),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]));
|
||||
|
||||
|
||||
// Process signals
|
||||
connect(process,SIGNAL(started()),this,SLOT(slotProcessStarted()));
|
||||
connect(process,SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||
this,SLOT(slotProcessFinished(int,QProcess::ExitStatus)));
|
||||
|
||||
connect(process,SIGNAL(error(QProcess::ProcessError)),
|
||||
this,SLOT(slotProcessError(QProcess::ProcessError)));
|
||||
|
||||
connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(slotProcessOutput()));
|
||||
connect(process,SIGNAL(readyReadStandardError()),
|
||||
this,SLOT(slotProcessErrorOutput()));
|
||||
|
||||
// Set tittle
|
||||
setWindowTitle(tr("OpenGNSys Browser"));
|
||||
|
||||
if(!readEnvironmentValues())
|
||||
text->insertPlainText(tr("Any environment variable/s didn't be setted\n"));
|
||||
|
||||
if(env.contains("OGLOGFILE") && env["OGLOGFILE"]!="")
|
||||
{
|
||||
logfile=new QFile(env["OGLOGFILE"]);
|
||||
if(!logfile->open(QIODevice::WriteOnly | QIODevice::Text |
|
||||
QIODevice::Append))
|
||||
{
|
||||
text->insertPlainText(tr("The log file couldn't be opened: ")+logfile->fileName());
|
||||
delete logfile;
|
||||
logfile=NULL;
|
||||
}
|
||||
else
|
||||
logstream=new QTextStream(logfile);
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
if(logfile)
|
||||
{
|
||||
logfile->close();
|
||||
delete logfile;
|
||||
}
|
||||
if(logstream)
|
||||
delete logstream;
|
||||
}
|
||||
|
||||
void MainWindow::slotLinkHandle(const QUrl &url)
|
||||
{
|
||||
QString string = url.toString();
|
||||
qDebug() << string;
|
||||
// Si es un link del tipo PROTOCOL lo ejecutamos
|
||||
if(string.startsWith(PROTOCOL))
|
||||
{
|
||||
string=string.remove(0,QString(PROTOCOL).length());
|
||||
QStringList list=string.split(" ",QString::SkipEmptyParts);
|
||||
QString command=list.takeFirst();
|
||||
process->setReadChannel(QProcess::StandardOutput);
|
||||
// Le ponemos el mismo entorno que tiene el browser ahora mismo
|
||||
process->setEnvironment(QProcess::systemEnvironment());
|
||||
process->start(command,list);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Load URL: " << url <<endl;
|
||||
web->load(url);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slotWebLoadStarted()
|
||||
{
|
||||
qDebug()<<"Empieza la carga de la web";
|
||||
}
|
||||
|
||||
void MainWindow::slotWebLoadProgress(int progress)
|
||||
{
|
||||
qDebug()<<"Progress "<<progress;
|
||||
}
|
||||
|
||||
void MainWindow::slotWebLoadFinished(bool ok)
|
||||
{
|
||||
// If any error ocurred, show a pop up
|
||||
// Sometimes when the url hasn't got a dot, i.e /var/www/pageweb,
|
||||
// the return value is always true so we check the bytes received too
|
||||
if(ok == false || web->page()->totalBytes() == 0)
|
||||
{
|
||||
qDebug()<<"Error accediendo a la web";
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("The web page couldn't load. What do you want to do?"));
|
||||
|
||||
QPushButton *reloadButton = msgBox.addButton(tr("Reload"), QMessageBox::ActionRole);
|
||||
msgBox.addButton(QMessageBox::Abort);
|
||||
|
||||
msgBox.exec();
|
||||
|
||||
if (msgBox.clickedButton() == reloadButton)
|
||||
{
|
||||
web->reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
else
|
||||
qDebug()<<"Descarga finalizada satisfactoriamente";
|
||||
}
|
||||
|
||||
void MainWindow::slotProcessStarted()
|
||||
{
|
||||
qDebug()<<"Proceso inicializado"<<endl;
|
||||
}
|
||||
|
||||
void MainWindow::slotProcessOutput()
|
||||
{
|
||||
qDebug()<<"Output"<<endl;
|
||||
process->setReadChannel(QProcess::StandardOutput);
|
||||
char buf[BUFFERSIZE];
|
||||
while((process->readLine(buf,BUFFERSIZE) > 0))
|
||||
{
|
||||
text->insertPlainText(buf);
|
||||
/*
|
||||
QString str="<b>";
|
||||
str+=buf;
|
||||
str+="</b>";
|
||||
text->insertHtml(str);
|
||||
*/
|
||||
output<<buf;
|
||||
if(logstream)
|
||||
*logstream<<CURRENT_TIME()<<": "<<buf;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slotProcessErrorOutput()
|
||||
{
|
||||
qDebug()<<"ErrorOutput"<<endl;
|
||||
process->setReadChannel(QProcess::StandardError);
|
||||
char buf[BUFFERSIZE];
|
||||
while((process->readLine(buf,BUFFERSIZE) > 0))
|
||||
{
|
||||
text->insertPlainText(buf);
|
||||
errors<<buf;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slotProcessFinished(int code,QProcess::ExitStatus status)
|
||||
{
|
||||
if(status==QProcess::NormalExit)
|
||||
{
|
||||
qDebug()<<"Finished: "<<code<<" "<<status<<endl;
|
||||
qDebug()<<"OUTPUT:"<<endl<<output<<endl<<"ERROR:"<<endl<<errors<<endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"Ha petado"<<endl;
|
||||
qDebug()<<"Finished: "<<code<<" "<<status<<endl;
|
||||
qDebug()<<"OUTPUT:"<<endl<<output<<endl<<"ERROR:"<<endl<<errors<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::slotProcessError(QProcess::ProcessError error)
|
||||
{
|
||||
switch(error)
|
||||
{
|
||||
case QProcess::FailedToStart:
|
||||
qDebug()<<"Imposible arrancar el programa"<<endl;
|
||||
break;
|
||||
// No capturo crashed porque la pillo por finished
|
||||
case QProcess::Crashed:
|
||||
case QProcess::Timedout:
|
||||
case QProcess::WriteError:
|
||||
case QProcess::ReadError:
|
||||
case QProcess::UnknownError:
|
||||
default:
|
||||
qDebug()<<"Otro error"<<endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int MainWindow::readEnvironmentValues()
|
||||
{
|
||||
// The return value
|
||||
int ret=true;
|
||||
|
||||
// Get all environment variables
|
||||
QStringList environmentlist=QProcess::systemEnvironment();
|
||||
// This is the list of the important variables
|
||||
QStringList variablelist=QString(ENVIRONMENT).split(",");
|
||||
|
||||
// This is an auxiliar variable
|
||||
QStringList stringlist;
|
||||
|
||||
foreach (QString str,variablelist)
|
||||
{
|
||||
// Look for the variable in the environment
|
||||
stringlist=environmentlist.filter(str+"=");
|
||||
|
||||
if(stringlist.isEmpty())
|
||||
{
|
||||
env[str]="";
|
||||
ret=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the first element and get the value part
|
||||
env[str]=(stringlist.first().split("="))[1];
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#define PROTOCOL "command:"
|
||||
#define ENVIRONMENT "OGLOGFILE"
|
||||
//#define ENVIRONMENT "OGIP,OGSERVER,OGLOG"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QProcess>
|
||||
#include <QMap>
|
||||
#include <QMainWindow>
|
||||
|
||||
class QWebView;
|
||||
class QTextEdit;
|
||||
class QVBoxLayout;
|
||||
class QProcess;
|
||||
class QStringList;
|
||||
class QString;
|
||||
class QUrl;
|
||||
class QFile;
|
||||
class QTextStream;
|
||||
class QDockWidget;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
// Funcion que maneja los links
|
||||
void slotLinkHandle(const QUrl& url);
|
||||
void slotWebLoadStarted();
|
||||
void slotWebLoadFinished(bool ok);
|
||||
void slotWebLoadProgress(int progress);
|
||||
|
||||
// Funciones que manejan cada vez que el proceso hace algo
|
||||
void slotProcessStarted();
|
||||
void slotProcessFinished(int code,QProcess::ExitStatus status);
|
||||
void slotProcessError(QProcess::ProcessError error);
|
||||
void slotProcessOutput();
|
||||
void slotProcessErrorOutput();
|
||||
|
||||
//Functions
|
||||
protected:
|
||||
int readEnvironmentValues();
|
||||
|
||||
|
||||
protected:
|
||||
QWebView *web;
|
||||
QTextEdit *text;
|
||||
QDockWidget *dock;
|
||||
|
||||
QProcess *process;
|
||||
QStringList output;
|
||||
QStringList errors;
|
||||
|
||||
QMap<QString,QString> env;
|
||||
QFile *logfile;
|
||||
QTextStream *logstream;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
Loading…
Reference in New Issue