aboutsummaryrefslogtreecommitdiff
path: root/desktop-utilities/lumina-terminal
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-utilities/lumina-terminal')
-rw-r--r--desktop-utilities/lumina-terminal/TerminalWidget.cpp4
-rw-r--r--desktop-utilities/lumina-terminal/TtyProcess.cpp13
-rw-r--r--desktop-utilities/lumina-terminal/TtyProcess.h18
-rw-r--r--desktop-utilities/lumina-terminal/lumina-terminal.pro2
-rw-r--r--desktop-utilities/lumina-terminal/main.cpp5
5 files changed, 26 insertions, 16 deletions
diff --git a/desktop-utilities/lumina-terminal/TerminalWidget.cpp b/desktop-utilities/lumina-terminal/TerminalWidget.cpp
index 326f1703..d733b7d3 100644
--- a/desktop-utilities/lumina-terminal/TerminalWidget.cpp
+++ b/desktop-utilities/lumina-terminal/TerminalWidget.cpp
@@ -19,7 +19,7 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent)
//Create/open the TTY port
PROC = new TTYProcess(this);
qDebug() << "Open new TTY";
- bool ok = PROC->start( QProcessEnvironment::systemEnvironment().value("SHELL","/bin/sh") );
+ bool ok = PROC->startTTY( QProcessEnvironment::systemEnvironment().value("SHELL","/bin/sh") );
qDebug() << " - opened:" << ok;
this->setEnabled(PROC->isOpen());
@@ -111,4 +111,4 @@ void TerminalWidget::mouseDoubleClickEvent(QMouseEvent *ev){
void TerminalWidget::contextMenuEvent(QContextMenuEvent *ev){
Q_UNUSED(ev);
-} \ No newline at end of file
+}
diff --git a/desktop-utilities/lumina-terminal/TtyProcess.cpp b/desktop-utilities/lumina-terminal/TtyProcess.cpp
index 1818a91b..f72b37a2 100644
--- a/desktop-utilities/lumina-terminal/TtyProcess.cpp
+++ b/desktop-utilities/lumina-terminal/TtyProcess.cpp
@@ -9,7 +9,7 @@
#include <sys/types.h>
#include <signal.h>
-TTYProcess::TTYProcess(QObject *parent) : QSerialPort(parent){
+TTYProcess::TTYProcess(QObject *parent) : QFile(parent){
childProc = 0;
}
@@ -18,7 +18,7 @@ TTYProcess::~TTYProcess(){
}
// === PUBLIC ===
-bool TTYProcess::start(QString prog, QStringList args){
+bool TTYProcess::startTTY(QString prog, QStringList args){
//Turn the program/arguments into C-compatible arrays
char cprog[prog.length()]; strcpy(cprog, prog.toLocal8Bit().data());
char *cargs[args.length()+1];
@@ -26,6 +26,7 @@ bool TTYProcess::start(QString prog, QStringList args){
if(i<args.length()){
cargs[i] = new char[ args[i].toLocal8Bit().size()+1];
strcpy( cargs[i], args[i].toLocal8Bit().data() );
+ cargs[i][strlen(args[i].toLocal8Bit())] = NULL;
}else{
cargs[i] = new char[1];
strcpy(cargs[i],"\0");
@@ -40,9 +41,10 @@ bool TTYProcess::start(QString prog, QStringList args){
if(tmp<0){ return false; } //error
else{
childProc = tmp;
- this->setPortName( ptsname(FD) );
- qDebug() << " - PTY:" << this->portName();
+ this->setFileName( ptsname(FD) );
+ //qDebug() << " - PTY:" << this->portName();
return this->open(QIODevice::ReadWrite);
+ //return true;
}
}
@@ -81,6 +83,9 @@ pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){
setsid(); //Make current process new session leader (so we can set controlling terminal)
ioctl(0,TIOCSCTTY, 1); //Set the controlling terminal to the slave PTY
+ // Example my_args which works
+ // char *my_args[] = { "/bin/csh", NULL };
+
//Execute the designated program
rc = execvp(prog, child_args);
::close(fds); //no need to keep original file descriptor open any more
diff --git a/desktop-utilities/lumina-terminal/TtyProcess.h b/desktop-utilities/lumina-terminal/TtyProcess.h
index c764b5ae..76b82d1f 100644
--- a/desktop-utilities/lumina-terminal/TtyProcess.h
+++ b/desktop-utilities/lumina-terminal/TtyProcess.h
@@ -12,16 +12,26 @@
#ifndef _LUMINA_DESKTOP_UTILITIES_TERMINAL_TTY_PROCESS_WIDGET_H
#define _LUMINA_DESKTOP_UTILITIES_TERMINAL_TTY_PROCESS_WIDGET_H
-#include <QSerialPort>
#include <QDebug>
+#include <QFile>
-class TTYProcess : public QSerialPort{
+//Standard C library functions for PTY access/setup
+#include <stdlib.h>
+#include <fcntl.h>
+#include <termios.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <signal.h>
+
+
+class TTYProcess : public QFile{
Q_OBJECT
public:
TTYProcess(QObject *parent = 0);
~TTYProcess();
- bool start(QString prog, QStringList args = QStringList());
+ bool startTTY(QString prog, QStringList args = QStringList());
private:
pid_t childProc;
@@ -40,4 +50,4 @@ private:
};
-#endif \ No newline at end of file
+#endif
diff --git a/desktop-utilities/lumina-terminal/lumina-terminal.pro b/desktop-utilities/lumina-terminal/lumina-terminal.pro
index 9cc58199..ee10bcd8 100644
--- a/desktop-utilities/lumina-terminal/lumina-terminal.pro
+++ b/desktop-utilities/lumina-terminal/lumina-terminal.pro
@@ -1,6 +1,6 @@
TEMPLATE = app
LANGUAGE = C++
-QT += core gui widgets network serialport
+QT += core gui widgets network
CONFIG += qt warn_on release
isEmpty(PREFIX) {
diff --git a/desktop-utilities/lumina-terminal/main.cpp b/desktop-utilities/lumina-terminal/main.cpp
index 9197561f..896f7765 100644
--- a/desktop-utilities/lumina-terminal/main.cpp
+++ b/desktop-utilities/lumina-terminal/main.cpp
@@ -6,7 +6,6 @@
//===========================================
#include <QSystemTrayIcon>
#include <QDebug>
-#include <QSerialPortInfo>
#include <LuminaSingleApplication.h>
#include <LuminaThemes.h>
@@ -15,10 +14,6 @@
#include "TrayIcon.h"
int main(int argc, char *argv[]) {
- /*if(QSerialPortInfo::availablePorts().isEmpty()){
- qDebug() << "No Serial Ports available!!!";
- return 1;
- }*/
LTHEME::LoadCustomEnvSettings();
LSingleApplication a(argc, argv, "lumina-terminal");
if( !a.isPrimaryProcess() ){ return 0; } //poked the current process instead
bgstack15