From 5af38d648e0ed27cc3a7aaf8984a88f53ef560f2 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Sat, 11 Jun 2016 15:50:55 -0400 Subject: Cleanup a bit more of the lumina-terminal. Color support is now in (with "xterm" set as the termcap interface), line wrapping is in as needed, the background is a bit more opaque now, and tabs close properly now. --- src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp | 7 ++++--- src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp | 13 +++++++++---- src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h | 1 + src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-terminal') diff --git a/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp b/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp index 5ef31a5f..b400ac6e 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TermWindow.cpp @@ -18,8 +18,7 @@ // PUBLIC // =============== TermWindow::TermWindow(QSettings *set) : QWidget(0, Qt::Window | Qt::BypassWindowManagerHint){//, ui(new Ui::TermWindow){ - this->setWindowOpacity(0.75); - //this->setStyleSheet( "QWidget{ background: transparent; }"); + this->setWindowOpacity(0.85); CLOSING = false; //internal flag settings = set; //Create the Window @@ -213,7 +212,7 @@ void TermWindow::New_Tab(){ } void TermWindow::Close_Tab(int tab){ - //qDebug() << "Close Tab:" << tab; + qDebug() << "Close Tab:" << tab; if(tab<0){ tab = tabWidget->currentIndex(); } static_cast(tabWidget->widget(tab))->aboutToClose(); tabWidget->widget(tab)->deleteLater(); //delete the page within the tag @@ -226,8 +225,10 @@ void TermWindow::Close_Tab(int tab){ void TermWindow::Close_Tab(QString ID){ //Close a tab based on it's ID instead of it's tab number + qDebug() << "Close Tab by ID:" << ID; for(int i=0; icount(); i++){ if(tabWidget->widget(i)->whatsThis()==ID){ + qDebug() << " - Start close by number:" << i; Close_Tab(i); return; //all done } diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp index e8f80f88..d9099452 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp @@ -18,13 +18,14 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent){ //Setup the text widget - this->setStyleSheet("background: black; color: white;"); + closing = false; + this->setStyleSheet("QTextEdit{ background: black; color: white; }"); this->setLineWrapMode(QTextEdit::WidgetWidth); this->setAcceptRichText(false); this->setOverwriteMode(true); this->setFocusPolicy(Qt::StrongFocus); this->setTabStopWidth( 8 * this->fontMetrics().width(" ") ); //8 character spaces per tab (UNIX standard) - this->setWordWrapMode(QTextOption::NoWrap); + //this->setWordWrapMode(QTextOption::NoWrap); this->setContextMenuPolicy(Qt::CustomContextMenu); DEFFMT = this->textCursor().charFormat(); //save the default structure for later DEFFMT.setForeground(Qt::white); @@ -59,7 +60,9 @@ TerminalWidget::~TerminalWidget(){ } void TerminalWidget::aboutToClose(){ + closing = true; if(PROC->isOpen()){ PROC->closeTTY(); } //TTY PORT + //delete PROC-> } // ================== @@ -79,7 +82,7 @@ void TerminalWidget::InsertText(QString txt){ sel.cursor = cur; sels << sel; this->setExtraSelections(sels); - qDebug() << "New Text. Format:" << CFMT.foreground() << CFMT.font(); + //qDebug() << "New Text. Format:" << CFMT.foreground() << CFMT.font(); } void TerminalWidget::applyData(QByteArray data){ @@ -429,7 +432,9 @@ void TerminalWidget::UpdateText(){ } void TerminalWidget::ShellClosed(){ - emit ProcessClosed(this->whatsThis()); + if(!closing){ + emit ProcessClosed(this->whatsThis()); + } } void TerminalWidget::copySelection(){ diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h index 32fd55ad..bdec606b 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h @@ -32,6 +32,7 @@ private: QMenu *contextMenu; QAction *copyA, *pasteA; int selectionStart; + bool closing; //Incoming Data parsing void InsertText(QString); diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp index 8d72e667..24124348 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp @@ -18,7 +18,7 @@ bool TTYProcess::startTTY(QString prog, QStringList args, QString workdir){ if(workdir=="~"){ workdir = QDir::homePath(); } QDir::setCurrent(workdir); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - setenv("TERM","vt100",1); //vt100: VT100 emulation support + setenv("TERM","xterm",1);//"vt100",1); //vt100: VT100 emulation support unsetenv("TERMCAP"); /*setenv("TERMCAP","mvterm|vv100|mvterm emulator with ANSI colors:\ :pa#64:Co#8:AF=\E[3%dm:AB=\E[4%dm:op=\E[100m:tc=vt102:",1); //see /etc/termcap as well*/ -- cgit