diff options
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp | 24 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h | 1 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp | 24 |
3 files changed, 38 insertions, 11 deletions
diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp index 398d80c0..83474f04 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp @@ -19,7 +19,10 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent){ //Setup the text widget closing = false; - this->setStyleSheet("QTextEdit{ background: black; color: white; }"); + QPalette P = this->palette(); + P.setColor(QPalette::Base, Qt::black); + P.setColor(QPalette::Text, Qt::white); + this->setPalette(P); this->setLineWrapMode(QTextEdit::WidgetWidth); this->setAcceptRichText(false); this->setOverwriteMode(true); @@ -37,14 +40,15 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent) QFontDatabase FDB; QStringList fonts = FDB.families(QFontDatabase::Latin); for(int i=0; i<fonts.length(); i++){ - if(FDB.isFixedPitch(fonts[i])){ this->setFont(QFont(fonts[i])); qDebug() << "Using Font:" << fonts[i]; break; } + if(FDB.isFixedPitch(fonts[i]) && FDB.isSmoothlyScalable(fonts[i]) ){ this->setFont(QFont(fonts[i])); qDebug() << "Using Font:" << fonts[i]; break; } + //if(FDB.isSmoothlyScalable(fonts[i]) ){ this->setFont(QFont(fonts[i])); qDebug() << "Using Font:" << fonts[i]; break; } } //Create/open the TTY port PROC = new TTYProcess(this); - qDebug() << "Open new TTY"; + //qDebug() << "Open new TTY"; //int fd; bool ok = PROC->startTTY( QProcessEnvironment::systemEnvironment().value("SHELL","/bin/sh"), QStringList(), dir); - qDebug() << " - opened:" << ok; + //qDebug() << " - opened:" << ok; this->setEnabled(PROC->isOpen()); contextMenu = new QMenu(this); copyA = contextMenu->addAction(LXDG::findIcon("edit-copy"), tr("Copy Selection"), this, SLOT(copySelection()) ); @@ -59,10 +63,14 @@ TerminalWidget::~TerminalWidget(){ aboutToClose(); } +void TerminalWidget::setTerminalFont(QFont font){ + this->setFont(font); +} + void TerminalWidget::aboutToClose(){ closing = true; if(PROC->isOpen()){ PROC->closeTTY(); } //TTY PORT - //delete PROC-> + } // ================== @@ -82,7 +90,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:"<< txt << CFMT.foreground() << CFMT.font() << CFMT.fontWeight(); } void TerminalWidget::applyData(QByteArray data){ @@ -485,9 +493,11 @@ void TerminalWidget::mousePressEvent(QMouseEvent *ev){ } void TerminalWidget::mouseMoveEvent(QMouseEvent *ev){ - if(ev->button()==Qt::LeftButton){ + //qDebug() << "MouseMove Event" << ev->button() << ev->buttons() << Qt::LeftButton; + if(ev->buttons().testFlag(Qt::LeftButton) ){ selCursor.setPosition(this->cursorForPosition(ev->pos()).position(), QTextCursor::KeepAnchor); if(selCursor.hasSelection()){ this->setTextCursor(selCursor); } + //qDebug() << "Mouse Movement:" << selCursor.hasSelection(); }else{ QTextEdit::mouseMoveEvent(ev); } diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h index bdec606b..16509cb4 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.h @@ -23,6 +23,7 @@ public: TerminalWidget(QWidget *parent =0, QString dir=""); ~TerminalWidget(); + void setTerminalFont(QFont); void aboutToClose(); private: diff --git a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp index e3ec64d8..88eeb1ec 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp @@ -23,9 +23,10 @@ bool TTYProcess::startTTY(QString prog, QStringList args, QString workdir){ if(workdir=="~"){ workdir = QDir::homePath(); } QDir::setCurrent(workdir); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - setenv("TERM","xterm",1); //"vt220-color",1);//"vt102-color",1); //vt100: VT100 emulation support (QTerminal sets "xterm" here) - unsetenv("TERMCAP"); - setenv("TERMCAP","vt220-color",1); + 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:\ :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:\ @@ -241,7 +242,22 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ //Also send the proper reply to this identify request right away writeTTY("\x1b[/Z"); } - +//Terminal Status request + index = raw.indexOf("\x1b[5n"); + while(index>=0){ + raw = raw.remove(index,1); + index = raw.indexOf("\x1b[5n"); + //Also send the proper reply to this identify request right away + writeTTY("\x1b[c"); //everything ok + } +//Terminal Identify request + index = raw.indexOf("\x1b[c"); + while(index>=0){ + raw = raw.remove(index,1); + index = raw.indexOf("\x1b[?1;7c"); + //Also send the proper reply to this identify request right away + writeTTY("\x1b[/Z"); + } incomplete = false; return raw; } |