summaryrefslogtreecommitdiffstats
path: root/client/browser
diff options
context:
space:
mode:
authoradelcastillo <adelcastillo@us.es>2009-11-02 18:02:50 +0000
committeradelcastillo <adelcastillo@us.es>2009-11-02 18:02:50 +0000
commit749e6b56dca024028e6bcfe2430de303074975bc (patch)
treed40531727e217033679390489b74fc988857460d /client/browser
parent1b66a79afd8fc62d5f13d02c3c5a3abc4d438129 (diff)
Ahora se pueden crear nuevas terminales
git-svn-id: https://opengnsys.es/svn/trunk@474 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/browser')
-rw-r--r--client/browser/mainwindow.cpp43
-rw-r--r--client/browser/mainwindow.h6
2 files changed, 29 insertions, 20 deletions
diff --git a/client/browser/mainwindow.cpp b/client/browser/mainwindow.cpp
index 5ed74e52..c528f949 100644
--- a/client/browser/mainwindow.cpp
+++ b/client/browser/mainwindow.cpp
@@ -24,7 +24,7 @@
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),web(new QWebView()),output(new QTextEdit()),
process(new QProcess(this)),
- logfile(NULL),logstream(NULL)
+ logfile(NULL),logstream(NULL),numberTerminal(0)
{
// Graphic
//showFullScreen();
@@ -45,10 +45,11 @@ MainWindow::MainWindow(QWidget *parent)
// TabWidget
tabs=new QTabWidget(dock);
+ QPushButton *button=new QPushButton(tr("&New Term"));
+ tabs->setCornerWidget(button);
- // Anyado output a las pestanyas
tabs->addTab(output,tr("Output"));
- tabs->addTab(createTerminal(),tr("Term 1"));
+ slotCreateTerminal();
// Las pestanyas al dock
dock->setWidget(tabs);
@@ -88,6 +89,8 @@ MainWindow::MainWindow(QWidget *parent)
connect(process,SIGNAL(readyReadStandardError()),
this,SLOT(slotProcessErrorOutput()));
+ connect(button,SIGNAL(clicked()),this,SLOT(slotCreateTerminal()));
+
if(!readEnvironmentValues())
output->insertPlainText(tr("Any environment variable/s didn't be setted\n"));
@@ -267,6 +270,24 @@ void MainWindow::slotProcessError(QProcess::ProcessError error)
}
}
+void MainWindow::slotCreateTerminal()
+{
+ 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);
+
+ ++numberTerminal;
+
+ QString name=tr("Term ")+QString::number(numberTerminal);
+ tabs->addTab(console,name);
+}
+
int MainWindow::readEnvironmentValues()
{
// The return value
@@ -299,19 +320,3 @@ 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;
-}
-
diff --git a/client/browser/mainwindow.h b/client/browser/mainwindow.h
index 535497d1..650aec3c 100644
--- a/client/browser/mainwindow.h
+++ b/client/browser/mainwindow.h
@@ -44,10 +44,12 @@ class MainWindow : public QMainWindow
void slotProcessOutput();
void slotProcessErrorOutput();
+ // Funcion para crear terminales
+ void slotCreateTerminal();
+
//Functions
protected:
int readEnvironmentValues();
- QTermWidget* createTerminal();
protected:
@@ -61,6 +63,8 @@ class MainWindow : public QMainWindow
QMap<QString,QString> env;
QFile *logfile;
QTextStream *logstream;
+
+ int numberTerminal;
};
#endif // MAINWINDOW_H