From 3ef3d00b097a8ea9a4131e70e3c1dbd9ee1c38a5 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 14 Dec 2016 15:07:38 -0500 Subject: Add some more PTY work on the terminal. --- .../lumina-terminal/TerminalWidget.cpp | 3 ++ .../desktop-utils/lumina-terminal/TtyProcess.cpp | 38 ++++++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp index 83474f04..e009b1c0 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp @@ -148,6 +148,9 @@ void TerminalWidget::applyANSI(QByteArray code){ else{ qDebug() << "Unhandled ANSI Code:" << code; } + /*}else if(code.startsWith("[@") && code.length()==3){ + //Strange VT220? code - just print the character after the @ + InsertText( QString(code[2]) );*/ }else if(code.startsWith("[")){ // VT100 ESCAPE CODES //CURSOR MOVEMENT diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp index 88eeb1ec..6fddee39 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp @@ -25,8 +25,8 @@ bool TTYProcess::startTTY(QString prog, QStringList args, QString workdir){ QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); setenv("TERM","vt220-color",1);//"vt102-color",1); //vt100: VT100 emulation support (QTerminal sets "xterm" here) //unsetenv("TERM"); - //unsetenv("TERMCAP"); - setenv("TERMCAP","xterm",1); + unsetenv("TERMCAP"); + //setenv("TERMCAP","xterm",1); /*setenv("TERMCAP",":do=2\E[B:co#80:li#24:cl=50\E[H\E[J:sf=2*\ED:\ :le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\ :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ @@ -42,7 +42,7 @@ bool TTYProcess::startTTY(QString prog, QStringList args, QString workdir){ :K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:K5=\EOn:pt:sr=2*\EM:xn:\ :sc=2\E7:rc=2\E8:cs=5\E[%i%d;%dr:UP=2\E[%dA:DO=2\E[%dB:RI=2\E[%dC:\ :LE=2\E[%dD:ct=2\E[3g:st=2\EH:ta=^I:ms:bl=^G:cr=^M:eo:it#8:\ - :RA=\E[?7l:SA=\E[?7h:po=\E[5i:pf=\E[4i:",1); //see /etc/termcap as well*/ + :RA=\E[?7l:SA=\E[?7h:po=\E[5i:pf=\E[4i:",1); //see /etc/termcap as well */ QStringList filter = env.keys().filter("XTERM"); for(int i=0; i=0){ + raw = raw.remove(index,3); + index = raw.indexOf("\x1b[@"); + } //VT102 Identify request index = raw.indexOf("\x1b[Z"); @@ -242,7 +248,7 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ //Also send the proper reply to this identify request right away writeTTY("\x1b[/Z"); } -//Terminal Status request + //Terminal Status request index = raw.indexOf("\x1b[5n"); while(index>=0){ raw = raw.remove(index,1); @@ -250,14 +256,15 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ //Also send the proper reply to this identify request right away writeTTY("\x1b[c"); //everything ok } -//Terminal Identify request + //Terminal Identify request index = raw.indexOf("\x1b[c"); while(index>=0){ raw = raw.remove(index,1); - index = raw.indexOf("\x1b[?1;7c"); + index = raw.indexOf("\x1b[c"); //Also send the proper reply to this identify request right away writeTTY("\x1b[/Z"); } + incomplete = false; return raw; } @@ -283,7 +290,24 @@ pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){ //Adjust the slave side mode to RAW struct termios TSET; rc = tcgetattr(fds, &TSET); //read the current settings - cfmakesane(&TSET); //set the RAW mode on the settings ( cfmakeraw(&TSET); ) + cfmakesane(&TSET); //set the SANE mode on the settings ( cfmakeraw(&TSET); ) + //Set Input Modes + TSET.c_iflag |= IGNPAR; //ignore parity errors + TSET.c_iflag &= ~(IGNBRK | PARMRK | ISTRIP | ICRNL | IXON | IXANY | IXOFF); //ignore special characters + //Set Local Modes + TSET.c_lflag &= (ECHO | ECHONL | ECHOKE); //Echo inputs (normal, newline, and KILL character line break) + TSET.c_lflag &= ~ICANON ; //non-canonical mode (individual inputs - not a line-at-a-time) + //Set Control Modes + TSET.c_cflag |= CLOCAL; //Local Terminal Connection (non-modem) + //TSET.c_lflag &= ~IEXTEN; + //TSET.c_cflag &= ~(CSIZE | PARENB); + //TSET.c_cflag |= CS8; + //tt.c_oflag &= ~OPOST; // disable special output processing + //Set Output Modes + TSET.c_oflag |= OPOST; + //TSET.c_oflag |= OXTABS; + TSET.c_cc[VTIME] = 0; // timeout + //Now apply the settings tcsetattr(fds, TCSANOW, &TSET); //apply the changed settings //Change the controlling terminal in child thread to the slave PTY -- cgit From d69b254246bdba863b7644cc25f168ab35181035 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 15 Dec 2016 16:12:43 -0500 Subject: Commit a lot more cleanup for the terminal. --- .../lumina-terminal/TerminalWidget.cpp | 89 +++++++++++++++------- .../desktop-utils/lumina-terminal/TerminalWidget.h | 3 + .../desktop-utils/lumina-terminal/TtyProcess.cpp | 44 +++++++---- src-qt5/desktop-utils/lumina-terminal/TtyProcess.h | 1 + 4 files changed, 94 insertions(+), 43 deletions(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp index e009b1c0..a4622817 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp @@ -14,6 +14,8 @@ #include +#define DEBUG 0 + //Special control code ending symbols (aside from letters) TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent){ @@ -30,6 +32,10 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent) this->setTabStopWidth( 8 * this->fontMetrics().width(" ") ); //8 character spaces per tab (UNIX standard) //this->setWordWrapMode(QTextOption::NoWrap); this->setContextMenuPolicy(Qt::CustomContextMenu); + resizeTimer = new QTimer(this); + resizeTimer->setInterval(20); + resizeTimer->setSingleShot(true); + connect(resizeTimer, SIGNAL(timeout()), this, SLOT(updateTermSize()) ); DEFFMT = this->textCursor().charFormat(); //save the default structure for later DEFFMT.setForeground(Qt::white); CFMT = DEFFMT; //current format @@ -49,7 +55,7 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent) //int fd; bool ok = PROC->startTTY( QProcessEnvironment::systemEnvironment().value("SHELL","/bin/sh"), QStringList(), dir); //qDebug() << " - opened:" << ok; - this->setEnabled(PROC->isOpen()); + this->setEnabled(false); contextMenu = new QMenu(this); copyA = contextMenu->addAction(LXDG::findIcon("edit-copy"), tr("Copy Selection"), this, SLOT(copySelection()) ); pasteA = contextMenu->addAction(LXDG::findIcon("edit-paste"), tr("Paste"), this, SLOT(pasteSelection()) ); @@ -64,6 +70,7 @@ TerminalWidget::~TerminalWidget(){ } void TerminalWidget::setTerminalFont(QFont font){ + this->setFont(font); } @@ -80,20 +87,26 @@ void TerminalWidget::InsertText(QString txt){ if(txt.isEmpty()){ return; } //qDebug() << "Insert Text:" << txt << "Cursor Pos:" << this->textCursor().position() << "Column:" << this->textCursor().columnNumber(); QTextCursor cur = this->textCursor(); + cur.setCharFormat(CFMT); + this->setTextCursor(cur); //ensure the current cursor has the proper format this->insertPlainText(txt); - cur.setPosition( this->textCursor().position(), QTextCursor::KeepAnchor); - cur.setCharFormat(CFMT); + /*cur.setPosition( this->textCursor().position(), QTextCursor::KeepAnchor); + //cur.setCharFormat(CFMT); //Now make sure the new characters are the right color QList sels = this->extraSelections(); QTextEdit::ExtraSelection sel; sel.format = CFMT; sel.cursor = cur; sels << sel; - this->setExtraSelections(sels); - //qDebug() << "New Text Format:"<< txt << CFMT.foreground() << CFMT.font() << CFMT.fontWeight(); + this->setExtraSelections(sels);*/ + if(DEBUG){ + qDebug() << "Insert Text:"<< txt << "Font Color:" << CFMT.foreground() << "Background Color:" << CFMT.background() << "Font Weight:" << CFMT.fontWeight(); + } } void TerminalWidget::applyData(QByteArray data){ + this->setEnabled(true); + if(DEBUG){ qDebug() << "Got Data: " << data; } //Make sure the current cursor is the right cursor if(this->textCursor()==selCursor){ this->setTextCursor(lastCursor); } //Iterate through the data and apply it when possible @@ -127,12 +140,15 @@ void TerminalWidget::applyData(QByteArray data){ //qDebug() << "Code:" << data.mid(i+1, end) << "Next Char:" << data[i+end+2]; i+=end; //move the final loop along - already handled these bytes - }else if( data.at(i) != '\r' ){ - chars.append(data.at(i)); - //Plaintext character - just add it here - //qDebug() << "Insert Text:" << data.at(i) << CFMT.foreground().color() << CFMT.background().color(); - //qDebug() << " " << this->currentCharFormat().foreground().color() << this->currentCharFormat().background().color(); - //this->textCursor().insertText( QChar(data.at(i)), CFMT ); + }else if( data.at(i) == '\r' ){ + //Move cursor to end of line + //qDebug() << "Got a return char"; + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::EndOfLine, QTextCursor::MoveAnchor, 1); + cur.removeSelectedText(); + this->setTextCursor(cur); + }else{ + chars.append(data.at(i)); //Add the character to the buffer } } //end loop over data if(!chars.isEmpty()){ InsertText(chars); } @@ -282,7 +298,18 @@ void TerminalWidget::applyANSI(QByteArray code){ cur.removeSelectedText(); this->setTextCursor(cur); } - + }else if(code.endsWith("g")){ + //Tab Clear codes (0 or 3 only) + int num = 0; + if(code.size()>2){ num = code.mid(1, code.size()-2).toInt(); } //everything in the middle + if(num==0){ //clear current column (delete key analogue) + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 1); + cur.removeSelectedText(); + this->setTextCursor(cur); + }else if(num==3){ //clear all + this->clear(); + } //SCROLL MOVEMENT CODES //}else if(code.endsWith("S")){ // SU - Scroll Up //qDebug() << "Scroll Up:" << code; @@ -292,16 +319,22 @@ void TerminalWidget::applyANSI(QByteArray code){ // GRAPHICS RENDERING }else if(code.endsWith("m")){ //Format: "[;m" (no limit to sections separated by ";") + //qDebug() << "Got Graphics Code:" << code; + code.chop(1); //chop the "m" off the end int start = 1; int end = code.indexOf(";"); while(end>start){ + //qDebug() << "Color Code:" << code << start << end << code.mid(start, end-start); applyANSIColor(code.mid(start, end-start).toInt()); //Now update the iterators and try again start = end; - end = code.indexOf(";",start+1); //go to the next one + end = code.indexOf(";",start); //go to the next one + //qDebug() << "Next end:" << end; } //Need the last section as well - end = code.size()-1; + end = code.size(); + if(start>1){ start ++; } + //qDebug() << "Color Code:" << code << start << end << code.mid(start, end-start); if(end>start){ applyANSIColor(code.mid(start, end-start).toInt());} else{ applyANSIColor(0); } @@ -356,11 +389,11 @@ void TerminalWidget::applyANSIColor(int code){ else if(code==37){ color=QColor(Qt::white); } //48: Special extended color setting (unsupported) else if(code==39){ color= DEFFMT.foreground().color(); } //reset to default color -QBrush brush = CFMT.background(); + QBrush brush = CFMT.foreground(); color.setAlpha(255); //fully opaque brush.setColor(color); CFMT.setForeground( brush ); - this->setTextColor(color); //just in case the format is not used + //this->setTextColor(color); //just in case the format is not used } else if(code>=40 && code<=49){ //Set the font color @@ -388,6 +421,7 @@ QBrush brush = CFMT.background(); else if(code==55){ CFMT.setFontOverline(false); } //disable overline //56-59: Reserved //60+: Not generally supported (special code for particular terminals such as aixterm) + else{ qDebug() << "Unknown Color Code:" << code; } } //Outgoing Data parsing @@ -440,7 +474,6 @@ void TerminalWidget::UpdateText(){ applyData(PROC->readTTY()); //adjust the scrollbar as needed this->ensureCursorVisible(); - //this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum()); } void TerminalWidget::ShellClosed(){ @@ -461,6 +494,16 @@ void TerminalWidget::pasteSelection(){ } } +void TerminalWidget::updateTermSize(){ + if(!PROC->isOpen()){ return; } + QSize pix = this->size(); //pixels + QSize chars; + chars.setWidth( pix.width()/this->fontMetrics().width("W") ); + chars.setHeight( pix.height()/this->fontMetrics().lineSpacing() ); + + PROC->setTerminalSize(chars,pix); +} + // ================== // PROTECTED // ================== @@ -468,11 +511,7 @@ void TerminalWidget::keyPressEvent(QKeyEvent *ev){ if(ev->text().isEmpty() || ev->text()=="\b" ){ sendKeyPress(ev->key()); - //PROC->writeTTY( QByteArray::fromHex(ev->nativeVirtualKey()) ); }else{ - if( (ev->key()==Qt::Key_Enter || ev->key()==Qt::Key_Return) && !this->textCursor().atEnd() ){ - sendKeyPress(Qt::Key_End); //just in case the cursor is not at the end (TTY will split lines and such - ugly) - } QByteArray ba; ba.append(ev->text()); //avoid any byte conversions //qDebug() << "Forward Input:" << ba; PROC->writeTTY(ba); @@ -524,12 +563,6 @@ void TerminalWidget::mouseDoubleClickEvent(QMouseEvent *ev){ } void TerminalWidget::resizeEvent(QResizeEvent *ev){ - if(!PROC->isOpen()){ return; } - QSize pix = ev->size(); //pixels - QSize chars; - chars.setWidth( pix.width()/this->fontMetrics().width("W") ); - chars.setHeight( pix.height()/this->fontMetrics().lineSpacing() ); - - PROC->setTerminalSize(chars,pix); + resizeTimer->start(); QTextEdit::resizeEvent(ev); } diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h index 16509cb4..616919c3 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h @@ -28,6 +28,7 @@ public: private: TTYProcess *PROC; + QTimer *resizeTimer; QTextCharFormat DEFFMT, CFMT; //default/current text format QTextCursor selCursor, lastCursor; QMenu *contextMenu; @@ -54,6 +55,8 @@ private slots: void copySelection(); void pasteSelection(); + void updateTermSize(); + signals: void ProcessClosed(QString); diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp index 6fddee39..6ddd876b 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp @@ -24,10 +24,14 @@ bool TTYProcess::startTTY(QString prog, QStringList args, QString workdir){ QDir::setCurrent(workdir); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); setenv("TERM","vt220-color",1);//"vt102-color",1); //vt100: VT100 emulation support (QTerminal sets "xterm" here) - //unsetenv("TERM"); - unsetenv("TERMCAP"); - //setenv("TERMCAP","xterm",1); - /*setenv("TERMCAP",":do=2\E[B:co#80:li#24:cl=50\E[H\E[J:sf=2*\ED:\ + + //setenv("TERMINFO","/etc/termcap",0); + unsetenv("WINDOWID"); + //unsetenv("TERMCAP"); + //setenv("TERMCAP","/etc/termcap",1); + //setenv("TERMCAP","vt220-color",1); + //setenv("TERMCAP","vt102|vt220-color|dec vt102:' :do=^J:co#80:li#24:cl=50\E[;H\E[2J: :le=^H:bs:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A: :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m: :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H: :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>: :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H: :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=5\EM:vt#3: :sc=\E7:rc=\E8:cs=\E[%i%d;%dr:vs=\E[?7l:ve=\E[?7h: :mi:al=\E[L:dc=\E[P:dl=\E[M:ei=\E[4l:im=\E[4h:' vi $*",1); + /*setenv("TERMCAP","'vt220-color' :do=2\E[B:co#80:li#24:cl=50\E[H\E[J:sf=2*\ED:\ :le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:\ :ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:\ :md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:\ @@ -134,7 +138,7 @@ QByteArray TTYProcess::readTTY(){ //If the PTY gets input fairly soon after starting, the PTY will re-print the initial line(s) if(starting && !BA.contains("\n") ){ //qDebug() << "Starting phase 1:" << BA; - writeTTY("\n\b"); //newline + backspace + writeTTY("tset\n"); //Terminal Setup utility (uses the TERM env variable) BA.clear(); }else if(starting){ //qDebug() << "Starting phase 2:" << BA; @@ -178,7 +182,6 @@ QByteArray TTYProcess::readTTY(){ void TTYProcess::setTerminalSize(QSize chars, QSize pixels){ if(ttyfd==0){ return; } - struct winsize c_sz; c_sz.ws_row = chars.height(); c_sz.ws_col = chars.width(); @@ -233,7 +236,7 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ raw = raw.remove(index,1); index = raw.indexOf("\x07"); } - //VT220(?) print character code + //VT220(?) print character code (cut out the code, leave the character) index=raw.indexOf("\x1b[@"); while(index>=0){ raw = raw.remove(index,3); @@ -243,7 +246,7 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ //VT102 Identify request index = raw.indexOf("\x1b[Z"); while(index>=0){ - raw = raw.remove(index,1); + raw = raw.remove(index,3); index = raw.indexOf("\x1b[Z"); //Also send the proper reply to this identify request right away writeTTY("\x1b[/Z"); @@ -251,7 +254,7 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ //Terminal Status request index = raw.indexOf("\x1b[5n"); while(index>=0){ - raw = raw.remove(index,1); + raw = raw.remove(index,4); index = raw.indexOf("\x1b[5n"); //Also send the proper reply to this identify request right away writeTTY("\x1b[c"); //everything ok @@ -259,9 +262,18 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ //Terminal Identify request index = raw.indexOf("\x1b[c"); while(index>=0){ - raw = raw.remove(index,1); + raw = raw.remove(index,3); index = raw.indexOf("\x1b[c"); //Also send the proper reply to this identify request right away + writeTTY("\x1b[1c"); //VT220 reply code + } + //Terminal Identify request (xterm/termcap?) + index = raw.indexOf("\x1b[P"); + while(index>=0){ + raw = raw.remove(index,3); + index = raw.indexOf("\x1b[P"); + //Also send the proper reply to this identify request right away + qDebug() << " - Got XTERM/TERMCAP identify request ([P)"; writeTTY("\x1b[/Z"); } @@ -272,28 +284,30 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ // === PRIVATE === pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){ //Returns: -1 for errors, positive value (file descriptor) for the master side of the TTY to watch - //First open/setup a new pseudo-terminal file/device on the system (master side) fd = posix_openpt(O_RDWR | O_NOCTTY); //open read/write if(fd<0){ return -1; } //could not create pseudo-terminal int rc = grantpt(fd); //set permissions if(rc!=0){ return -1; } rc = unlockpt(fd); //unlock file (ready for use) + //rc = fchown(fd, getuid(), getgid()); if(rc!=0){ return -1; } //Now fork, return the Master device and setup the child pid_t PID = fork(); if(PID==0){ //SLAVE/child int fds = ::open(ptsname(fd), O_RDWR | O_NOCTTY); //open slave side read/write - ::close(fd); //close the master side from the slave thread + //rc = fchown(fds, getuid(), getgid()); + //::close(fd); //close the master side from the slave thread - //Adjust the slave side mode to RAW + //Adjust the slave side mode to SANE struct termios TSET; rc = tcgetattr(fds, &TSET); //read the current settings - cfmakesane(&TSET); //set the SANE mode on the settings ( cfmakeraw(&TSET); ) + //cfmakesane(&TSET); //set the SANE mode on the settings ( RAW: cfmakeraw(&TSET); ) //Set Input Modes TSET.c_iflag |= IGNPAR; //ignore parity errors TSET.c_iflag &= ~(IGNBRK | PARMRK | ISTRIP | ICRNL | IXON | IXANY | IXOFF); //ignore special characters + //TSET.c_iflag &= IUTF8; //enable UTF-8 support //Set Local Modes TSET.c_lflag &= (ECHO | ECHONL | ECHOKE); //Echo inputs (normal, newline, and KILL character line break) TSET.c_lflag &= ~ICANON ; //non-canonical mode (individual inputs - not a line-at-a-time) @@ -309,7 +323,6 @@ pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){ TSET.c_cc[VTIME] = 0; // timeout //Now apply the settings tcsetattr(fds, TCSANOW, &TSET); //apply the changed settings - //Change the controlling terminal in child thread to the slave PTY ::close(0); //close current terminal standard input ::close(1); //close current terminal standard output @@ -322,6 +335,7 @@ pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){ ioctl(0,TIOCSCTTY, 1); //Set the controlling terminal to the slave PTY //Execute the designated program + //rc = execvp("tset", NULL); rc = execvp(prog, child_args); ::close(fds); //no need to keep original file descriptor open any more exit(rc); diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h index c2b483a9..97b4626b 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h @@ -32,6 +32,7 @@ #include #include #include +//#include class TTYProcess : public QObject{ Q_OBJECT -- cgit From 42210dc6fa063a33b637dbe12574494f4f8e6a10 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 16 Dec 2016 09:46:38 -0500 Subject: A bit more cleanup for the terminal. --- .../lumina-terminal/TerminalWidget.cpp | 9 +-- .../desktop-utils/lumina-terminal/TtyProcess.cpp | 67 +++++++++++++--------- src-qt5/desktop-utils/lumina-terminal/TtyProcess.h | 5 +- 3 files changed, 47 insertions(+), 34 deletions(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp index a4622817..906252cf 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp @@ -164,9 +164,10 @@ void TerminalWidget::applyANSI(QByteArray code){ else{ qDebug() << "Unhandled ANSI Code:" << code; } - /*}else if(code.startsWith("[@") && code.length()==3){ - //Strange VT220? code - just print the character after the @ - InsertText( QString(code[2]) );*/ + + }else if(code.startsWith("[") && code.contains("@")){ + code = code.remove(0, code.indexOf("@")+1); + InsertText(code); //insert character (cursor position already accounted for with other systems) }else if(code.startsWith("[")){ // VT100 ESCAPE CODES //CURSOR MOVEMENT @@ -432,7 +433,7 @@ void TerminalWidget::sendKeyPress(int key){ //Check for special keys switch(key){ case Qt::Key_Delete: - ba.append("\x7F"); + ba.append("\e[3~"); break; case Qt::Key_Backspace: ba.append("\x08"); diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp index 6ddd876b..a4550fe3 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp @@ -4,7 +4,7 @@ #include #include -#define DEBUG 0 +#define DEBUG 1 TTYProcess::TTYProcess(QObject *parent) : QObject(parent){ childProc = 0; @@ -107,7 +107,7 @@ void TTYProcess::closeTTY(){ void TTYProcess::writeTTY(QByteArray output){ //qDebug() << "Write:" << output; static QList knownFixes; - if(knownFixes.isEmpty()){ knownFixes << "\x1b[C" << "\x1b[D" << "\b" << "\x7F" << "\x08"; } + if(knownFixes.isEmpty()){ knownFixes << "\x1b[C" << "\x1b[D" << "\b" << "\x7F" << "\x08"; }//<<"\x1b[H"<<"\x1b[F"; } fixReply = knownFixes.indexOf(output); ::write(ttyfd, output.data(), output.size()); } @@ -172,6 +172,12 @@ QByteArray TTYProcess::readTTY(){ } } break; + case 5: //Home Key + BA = "\x1b[H"; + break; + case 6: //End Key + BA = "\x1b[F"; + break; } fixReply = -1; //done with the fix - resume normal operations if(DEBUG){ qDebug() << " - Fixed:" << BA; } @@ -268,14 +274,14 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ writeTTY("\x1b[1c"); //VT220 reply code } //Terminal Identify request (xterm/termcap?) - index = raw.indexOf("\x1b[P"); + /*index = raw.indexOf("\x1b[P"); while(index>=0){ raw = raw.remove(index,3); index = raw.indexOf("\x1b[P"); //Also send the proper reply to this identify request right away qDebug() << " - Got XTERM/TERMCAP identify request ([P)"; writeTTY("\x1b[/Z"); - } + }*/ incomplete = false; return raw; @@ -291,38 +297,18 @@ pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){ if(rc!=0){ return -1; } rc = unlockpt(fd); //unlock file (ready for use) //rc = fchown(fd, getuid(), getgid()); + setupTtyFd(fd); if(rc!=0){ return -1; } //Now fork, return the Master device and setup the child pid_t PID = fork(); if(PID==0){ //SLAVE/child int fds = ::open(ptsname(fd), O_RDWR | O_NOCTTY); //open slave side read/write - //rc = fchown(fds, getuid(), getgid()); - //::close(fd); //close the master side from the slave thread + rc = fchown(fds, getuid(), getgid()); + ::close(fd); //close the master side from the slave thread //Adjust the slave side mode to SANE - struct termios TSET; - rc = tcgetattr(fds, &TSET); //read the current settings - //cfmakesane(&TSET); //set the SANE mode on the settings ( RAW: cfmakeraw(&TSET); ) - //Set Input Modes - TSET.c_iflag |= IGNPAR; //ignore parity errors - TSET.c_iflag &= ~(IGNBRK | PARMRK | ISTRIP | ICRNL | IXON | IXANY | IXOFF); //ignore special characters - //TSET.c_iflag &= IUTF8; //enable UTF-8 support - //Set Local Modes - TSET.c_lflag &= (ECHO | ECHONL | ECHOKE); //Echo inputs (normal, newline, and KILL character line break) - TSET.c_lflag &= ~ICANON ; //non-canonical mode (individual inputs - not a line-at-a-time) - //Set Control Modes - TSET.c_cflag |= CLOCAL; //Local Terminal Connection (non-modem) - //TSET.c_lflag &= ~IEXTEN; - //TSET.c_cflag &= ~(CSIZE | PARENB); - //TSET.c_cflag |= CS8; - //tt.c_oflag &= ~OPOST; // disable special output processing - //Set Output Modes - TSET.c_oflag |= OPOST; - //TSET.c_oflag |= OXTABS; - TSET.c_cc[VTIME] = 0; // timeout - //Now apply the settings - tcsetattr(fds, TCSANOW, &TSET); //apply the changed settings + setupTtyFd(fds); //Change the controlling terminal in child thread to the slave PTY ::close(0); //close current terminal standard input ::close(1); //close current terminal standard output @@ -344,6 +330,31 @@ pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){ return PID; } +void TTYProcess::setupTtyFd(int fd){ + struct termios TSET; + tcgetattr(fd, &TSET); //read the current settings + cfmakesane(&TSET); //set the SANE mode on the settings ( RAW: cfmakeraw(&TSET); ) + //Set Input Modes + //TSET.c_iflag |= IGNPAR; //ignore parity errors + //TSET.c_iflag &= ~(IGNBRK | PARMRK | ISTRIP | ICRNL | IXON | IXANY | IXOFF); //ignore special characters + //TSET.c_iflag &= IUTF8; //enable UTF-8 support + //Set Local Modes + //TSET.c_lflag &= (ECHO | ECHONL | ECHOKE); //Echo inputs (normal, newline, and KILL character line break) + //TSET.c_lflag &= ~ICANON ; //non-canonical mode (individual inputs - not a line-at-a-time) + //Set Control Modes + //TSET.c_cflag |= CLOCAL; //Local Terminal Connection (non-modem) + //TSET.c_lflag &= ~IEXTEN; + //TSET.c_cflag &= ~(CSIZE | PARENB); + //TSET.c_cflag |= CS8; + //tt.c_oflag &= ~OPOST; // disable special output processing + //Set Output Modes + //TSET.c_oflag |= OPOST; + //TSET.c_oflag |= OXTABS; + TSET.c_cc[VTIME] = 0; // timeout + //Now apply the settings + tcsetattr(fd, TCSANOW, &TSET); //apply the changed settings +} + // === PRIVATE SLOTS === void TTYProcess::checkStatus(int sock){ //This is run when the socket gets activated diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h index 97b4626b..f8d709a8 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h @@ -73,8 +73,9 @@ private: // Returns: // -1 for errors, child process PID (positive integer) if successful //==================================== - static pid_t LaunchProcess(int& fd, char *prog, char **child_args); - + pid_t LaunchProcess(int& fd, char *prog, char **child_args); + void setupTtyFd(pid_t fd); + private slots: void checkStatus(int); -- cgit From 4f546a4aca08d192aaedd0e9e2c8b7c14ad748a3 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Fri, 16 Dec 2016 10:28:29 -0500 Subject: Hide the small menu popup during the lumina-fm init routine. --- src-qt5/desktop-utils/lumina-fm/MainUI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp index b017600b..c302c869 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp @@ -26,7 +26,6 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ waitingToClose = false; ui->setupUi(this); - ui->menuGit->setVisible( GIT::isAvailable() ); if(DEBUG){ qDebug() << "Initilization:"; } settings = new QSettings( QSettings::UserScope, "lumina-desktop", "lumina-fm", this); @@ -193,6 +192,7 @@ void MainUI::OpenDirs(QStringList dirs){ //qDebug() << "OpenDirs:" << DWLIST.length() << dirs << invalid << tabBar->currentIndex(); if(DWLIST.isEmpty()){ OpenDirs(QStringList()); } waitingToClose = false; + ui->menuGit->setVisible( GIT::isAvailable() ); } void MainUI::setupIcons(){ -- cgit From a43fb0a21a4bc7d180a21b7c539dcc251c401729 Mon Sep 17 00:00:00 2001 From: Davidmp Date: Mon, 19 Dec 2016 15:37:24 +0000 Subject: Translated using Weblate (lumina_FM@ca (generated)) Currently translated at 100.0% (221 of 221 strings) --- .../desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts | 142 ++++++++++----------- 1 file changed, 71 insertions(+), 71 deletions(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts index d5ef22db..1c5e85a9 100644 --- a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts +++ b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts @@ -59,52 +59,52 @@ Name - Nom + Nom Size - Mida + Mida Type - Tipus + Tipus Date Modified - Data de modificació + Data de modificació Date Created - Data de creació: + Data de creació Capacity: %1 - Capacitat: %1 + Capacitat: %1 Files: %1 (%2) - Fitxers: %1 (%2) + Fitxers: %1 (%2) Files: %1 - + Fitxers: %1 Dirs: %1 - Directoris: %1 + Directoris: %1 No Directory Contents - + No hi ha contingut de directori @@ -117,12 +117,12 @@ Increase Icon Sizes - + Augmenta la mida de les icones Decrease Icon Sizes - + Disminueix la mida de les icones @@ -160,32 +160,32 @@ Menu - + Menú Select Action - + Seleccioneu l'acció SingleColumn - + Una columna Single column view - + Vista d'una columna Dual Column - + Dues columnes Dual Column View - + Vista de dues columnes @@ -213,7 +213,7 @@ The document could not be created. Please ensure that you have the proper permissions. - No s'ha pogut crear el document. Si us plau, assegureu-vos que teniu els permisos adients. + No s'ha pogut crear el document. Si us plau, assegureu-vos que teniu els permisos adients. @@ -230,17 +230,17 @@ File Operations - + Operacions de fitxers Directory Operations - + Operacions de directoris Loading... - + Carregant... @@ -257,7 +257,7 @@ The directory could not be created. Please ensure that you have the proper permissions to modify the current directory. - No s'ha pogut crear el directori. Si us plau, assegureu-vos que teniu els permisos corresponents per modificar el directori actual. + No s'ha pogut crear el directori. Si us plau, assegureu-vos que teniu els permisos corresponents per modificar el directori actual. @@ -267,62 +267,62 @@ Create... - + Crea... File - Fitxer + Fitxer Directory - + Directori Application Launcher - + Llançador d'aplicacions Launch... - + Obre... Terminal - + Terminal SlideShow - + Presentació Multimedia Player - + Reproductor multimèdia Modify Files... - + Modifica els fitxers... View Files... - + Mostra els fitxers... Checksums - + Sumes de verificació Properties - + Propietats @@ -336,8 +336,8 @@ - The "lumina-fileinfo" utility could not be found on the system. Please install it first. - No s'ha pogut trobar la utilitat "lumina-fileinfo" al sistema. Si us plau, instal·leu-la primer. + The "lumina-fileinfo" utility could not be found on the system. Please install it first. + No s'ha pogut trobar la utilitat "lumina-fileinfo" al sistema. Si us plau, instal·leu-la primer. @@ -410,7 +410,7 @@ Note: It will just add a number to the filename otherwise. - Nota: si no, només s'afegirà un número al nom del fitxer. + Nota: si no, només s'afegirà un número al nom del fitxer. @@ -435,22 +435,22 @@ Could not remove these files: - No s'han pogut suprimir aquests fitxers: + No s'han pogut suprimir aquests fitxers: Could not copy these files: - No s'han pogut copiar aquests fitxers: + No s'han pogut copiar aquests fitxers: Could not restore these files: - No s'han pogut restaurar aquests fitxers: + No s'han pogut restaurar aquests fitxers: Could not move these files: - No s'han pogut moure aquests fitxers: + No s'han pogut moure aquests fitxers: @@ -471,7 +471,7 @@ Old Location: %1 New Location: %2 - No és possible moure un directori a dins de si mateix. Si us plau, en comptes d'això, feu-ne una còpia. + No és possible moure un directori a dins de si mateix. Si us plau, en comptes d'això, feu-ne una còpia. Localització antiga: %1 Localització nova: %2 @@ -492,7 +492,7 @@ Localització nova: %2 This wizard will guide you through the process of downloading a GIT repository from the internet. - Aquest assistent us guiarà a través del procés de baixada d'un repositori GIT des d'Internet. + Aquest assistent us guiarà a través del procés de baixada d'un repositori GIT des d'Internet. @@ -517,7 +517,7 @@ Localització nova: %2 Type of Access - Tipus d'accés + Tipus d'accés @@ -532,7 +532,7 @@ Localització nova: %2 Username - Nom d'usuari + Nom d'usuari @@ -571,8 +571,8 @@ Localització nova: %2 - Click "Next" to start downloading the repository - Cliqueu a "Següent" per començar a baixar el repositori + Click "Next" to start downloading the repository + Cliqueu a "Següent" per començar a baixar el repositori @@ -620,7 +620,7 @@ Localització nova: %2 Bookmarks - Adreces d'interès + Adreces d'interès @@ -635,7 +635,7 @@ Localització nova: %2 New Tab - + Pestanya nova @@ -690,7 +690,7 @@ Localització nova: %2 Add Bookmark - Afegeix una adreça d'interès + Afegeix una adreça d'interès @@ -715,7 +715,7 @@ Localització nova: %2 Close Tab - + Tanca la pestanya @@ -760,12 +760,12 @@ Localització nova: %2 Manage Bookmarks - Gestiona les adreces d'interès / marcadors + Gestiona les adreces d'interès / marcadors Show Action Buttons - Mostra els botons d'acció + Mostra els botons d'acció @@ -845,7 +845,7 @@ Localització nova: %2 The following directories are invalid and could not be opened: - Els directoris següents no són vàlids i no s'han pogut obrir: + Els directoris següents no són vàlids i no s'han pogut obrir: @@ -865,7 +865,7 @@ Localització nova: %2 New Bookmark - Adreça d'interès nova + Adreça d'interès nova @@ -880,7 +880,7 @@ Localització nova: %2 This bookmark name already exists. Please choose another. - Aquest nom d'adreça d'interès ja existeix. Trieu-ne un altre. + Aquest nom d'adreça d'interès ja existeix. Trieu-ne un altre. @@ -1001,43 +1001,43 @@ Localització nova: %2 Form - Formulari + Formulari ... - ... + ... Evaluating... - + Avaluant... Move - + Mou Copy - + Copia Remove - + Elimina %1 Finished - + %1 acabat Errors Occured - + Hi ha hagut errors @@ -1050,17 +1050,17 @@ Localització nova: %2 Delete this image file - Suprimeix aquest fitxer d'imatge + Suprimeix aquest fitxer d'imatge Rotate this image file counter-clockwise - Gira aquest fitxer d'imatge cap a l'esquerra + Gira aquest fitxer d'imatge cap a l'esquerra Rotate this image file clockwise - Gira aquest fitxer d'imatge cap a la dreta + Gira aquest fitxer d'imatge cap a la dreta @@ -1148,17 +1148,17 @@ Localització nova: %2 Finished - Acabat + Acabat Errors during operation. Click to view details - + Hi ha hagut errors durant l'operació. Cliqueu aquí per veure'n els detalls. No Errors - + Sense errors -- cgit From f2d0e2a554ea44377dcb8ab3ea2ec8ece07e379e Mon Sep 17 00:00:00 2001 From: Davidmp Date: Mon, 19 Dec 2016 15:38:19 +0000 Subject: Translated using Weblate (lumina_FM@ca (generated)) Currently translated at 100.0% (221 of 221 strings) --- src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts index 1c5e85a9..100f0aec 100644 --- a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts +++ b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_ca.ts @@ -1027,7 +1027,7 @@ Localització nova: %2 Remove - Elimina + Suprimeix -- cgit From c6ab5c4c56f49af67dcd0e2334b7a5a860a869ee Mon Sep 17 00:00:00 2001 From: Moo Date: Mon, 19 Dec 2016 11:02:51 +0000 Subject: Translated using Weblate (lumina_FM@lt (generated)) Currently translated at 92.3% (204 of 221 strings) --- .../desktop-utils/lumina-fm/i18n/lumina-fm_lt.ts | 66 +++++++++++----------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_lt.ts b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_lt.ts index 0839e33c..726f494f 100644 --- a/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_lt.ts +++ b/src-qt5/desktop-utils/lumina-fm/i18n/lumina-fm_lt.ts @@ -59,52 +59,52 @@ Name - Pavadinimas + Pavadinimas Size - Dydis + Dydis Type - Tipas + Tipas Date Modified - Keitimo data + Keitimo data Date Created - Sukūrimo data + Sukūrimo data Capacity: %1 - Talpa: %1 + Talpa: %1 Files: %1 (%2) - Failai: %1 (%2) + Failai: %1 (%2) Files: %1 - + Failai: %1 Dirs: %1 - Katalogai: %1 + Katalogai: %1 No Directory Contents - + Nėra katalogo turinio @@ -117,12 +117,12 @@ Increase Icon Sizes - + Padidinti piktogramų dydį Decrease Icon Sizes - + Sumažinti piktogramų dydį @@ -160,7 +160,7 @@ Menu - + Meniu @@ -230,17 +230,17 @@ File Operations - + Failų operacijos Directory Operations - + Katalogų operacijos Loading... - + Įkeliama... @@ -267,7 +267,7 @@ Create... - + Sukurti... @@ -317,12 +317,12 @@ Checksums - + Kontrolinės sumos Properties - + Savybės @@ -336,8 +336,8 @@ - The "lumina-fileinfo" utility could not be found on the system. Please install it first. - Sistemoje nepavyko rasti "lumina-fileinfo" paslaugų programos. Prašome, iš pradžių, ją įdiegti. + The "lumina-fileinfo" utility could not be found on the system. Please install it first. + Sistemoje nepavyko rasti "lumina-fileinfo" paslaugų programos. Prašome, iš pradžių, ją įdiegti. @@ -571,8 +571,8 @@ Nauja vieta: %2 - Click "Next" to start downloading the repository - Spustelėkite "Kitas", kad pradėtumėte saugyklos atsisiuntimą + Click "Next" to start downloading the repository + Spustelėkite "Kitas", kad pradėtumėte saugyklos atsisiuntimą @@ -635,7 +635,7 @@ Nauja vieta: %2 New Tab - + Nauja kortelė @@ -715,7 +715,7 @@ Nauja vieta: %2 Close Tab - + Užverti kortelę @@ -1001,13 +1001,13 @@ Nauja vieta: %2 Form - Forma + Forma ... - ... + ... @@ -1017,17 +1017,17 @@ Nauja vieta: %2 Move - + Perkelti Copy - + Kopijuoti Remove - + Šalinti @@ -1148,17 +1148,17 @@ Nauja vieta: %2 Finished - Užbaigta + Užbaigta Errors during operation. Click to view details - + Klaidos operacijos metu. Spustelėkite, kad pamatytumėte išsamesnę informaciją No Errors - + Nėra klaidų -- cgit From cea730d170be4cb2e06d36e5a5a892f8902e6517 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 19 Dec 2016 12:14:39 -0500 Subject: Bump up the reported precision of the lumina-calculator result to a max of 7 digits before switching to exponential notation. --- src-qt5/desktop-utils/lumina-calculator/mainUI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp index 057e4ddd..6ba7450b 100644 --- a/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-calculator/mainUI.cpp @@ -121,7 +121,7 @@ void mainUI::start_calc(){ double result = strToNumber(eq); if(result!=result){ return; } //bad calculation - NaN's values are special in that they don't equal itself QString res = "[#%1] %2 \t= [ %3 ]"; - ui->list_results->addItem(res.arg(QString::number(ui->list_results->count()+1), QString::number(result, 'G'), ui->line_eq->text())); + ui->list_results->addItem(res.arg(QString::number(ui->list_results->count()+1), QString::number(result, 'G', 7), ui->line_eq->text())); ui->list_results->scrollToItem( ui->list_results->item( ui->list_results->count()-1) ); ui->line_eq->clear(); } -- cgit From fdaac6792611fd0203e0e475768ece4d1379fff8 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 21 Dec 2016 10:35:53 -0500 Subject: Move the terminal over to the standardized "forkpty()" function for doing the initial setup. This does not fix the PTY registration yet - but removes the possibility of one of the other steps causing the problems. --- src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp | 16 +++++++++++++--- src-qt5/desktop-utils/lumina-terminal/TtyProcess.h | 2 +- .../desktop-utils/lumina-terminal/lumina-terminal.pro | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp index a4550fe3..b6ef8f6d 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp @@ -291,8 +291,18 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){ //Returns: -1 for errors, positive value (file descriptor) for the master side of the TTY to watch //First open/setup a new pseudo-terminal file/device on the system (master side) - fd = posix_openpt(O_RDWR | O_NOCTTY); //open read/write - if(fd<0){ return -1; } //could not create pseudo-terminal + //fd = posix_openpt(O_RDWR | O_NOCTTY); //open read/write + pid_t PID = forkpty( &fd, 0, 0, 0); + if(PID==0){ + //Child process + int rc = execvp(prog, child_args); + //::close(fds); //no need to keep original file descriptor open any more + exit(rc); + }else{ + //Master process + return PID; + } + /*if(fd<0){ return -1; } //could not create pseudo-terminal int rc = grantpt(fd); //set permissions if(rc!=0){ return -1; } rc = unlockpt(fd); //unlock file (ready for use) @@ -325,7 +335,7 @@ pid_t TTYProcess::LaunchProcess(int& fd, char *prog, char **child_args){ rc = execvp(prog, child_args); ::close(fds); //no need to keep original file descriptor open any more exit(rc); - } + }*/ //MASTER thread (or error) return PID; } diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h index f8d709a8..42684112 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h @@ -32,7 +32,7 @@ #include #include #include -//#include +#include class TTYProcess : public QObject{ Q_OBJECT diff --git a/src-qt5/desktop-utils/lumina-terminal/lumina-terminal.pro b/src-qt5/desktop-utils/lumina-terminal/lumina-terminal.pro index 4c623087..5216372c 100644 --- a/src-qt5/desktop-utils/lumina-terminal/lumina-terminal.pro +++ b/src-qt5/desktop-utils/lumina-terminal/lumina-terminal.pro @@ -23,7 +23,7 @@ SOURCES += main.cpp \ TtyProcess.cpp -LIBS += -lncurses +LIBS += -lutil TRANSLATIONS = i18n/l-terminal_af.ts \ -- cgit From 39e07a9256956a5f6af606375a679915d4e35215 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 22 Dec 2016 12:09:44 -0500 Subject: Fix an issue with ZFS snapshot finding where the directory path of interest needs to be converted into the canonical path (evaluate all symlink redirects) first before the ZFS snapshot finder does it's work. --- src-qt5/desktop-utils/lumina-fm/DirData.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src-qt5/desktop-utils') diff --git a/src-qt5/desktop-utils/lumina-fm/DirData.h b/src-qt5/desktop-utils/lumina-fm/DirData.h index c887ed5c..528a82d6 100644 --- a/src-qt5/desktop-utils/lumina-fm/DirData.h +++ b/src-qt5/desktop-utils/lumina-fm/DirData.h @@ -78,17 +78,18 @@ public: } void findSnapDir(){ + QString canonpath = QDir(dirpath).canonicalPath(); //Search the filesystem - if(dirpath.contains(ZSNAPDIR)){ - snapdir = dirpath.section(ZSNAPDIR,0,0)+ZSNAPDIR; //no need to go looking for it + if(canonpath.contains(ZSNAPDIR)){ + snapdir =canonpath.section(ZSNAPDIR,0,0)+ZSNAPDIR; //no need to go looking for it }else if(mntpoints.isEmpty()){ snapdir.clear(); //no zfs dirs available }else{ //Only check the mountpoint associated with this directory QString mnt; for(int i=0; imnt.length()){ mnt = mntpoints[i]; } + if(canonpath == mntpoints[i]){ mnt = mntpoints[i]; break; } + else if(canonpath.startsWith(mntpoints[i]) && mntpoints[i].length()>mnt.length()){ mnt = mntpoints[i]; } } if(QFile::exists(mnt+ZSNAPDIR)){ snapdir = mnt+ZSNAPDIR; } else{ snapdir.clear(); } //none found -- cgit