diff options
Diffstat (limited to 'desktop-utilities/lumina-terminal')
-rw-r--r-- | desktop-utilities/lumina-terminal/TermWindow.cpp | 36 | ||||
-rw-r--r-- | desktop-utilities/lumina-terminal/TermWindow.h | 6 | ||||
-rw-r--r-- | desktop-utilities/lumina-terminal/TerminalWidget.cpp | 181 | ||||
-rw-r--r-- | desktop-utilities/lumina-terminal/TerminalWidget.h | 13 | ||||
-rw-r--r-- | desktop-utilities/lumina-terminal/TrayIcon.cpp | 4 | ||||
-rw-r--r-- | desktop-utilities/lumina-terminal/TtyProcess.cpp | 6 | ||||
-rw-r--r-- | desktop-utilities/lumina-terminal/lumina-terminal.pro | 28 |
7 files changed, 186 insertions, 88 deletions
diff --git a/desktop-utilities/lumina-terminal/TermWindow.cpp b/desktop-utilities/lumina-terminal/TermWindow.cpp index 6dfab80a..b79e5fb5 100644 --- a/desktop-utilities/lumina-terminal/TermWindow.cpp +++ b/desktop-utilities/lumina-terminal/TermWindow.cpp @@ -40,12 +40,22 @@ TermWindow::TermWindow(QSettings *set) : QWidget(0, Qt::Window | Qt::BypassWindo closeS = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q),this); newTabS = new QShortcut(QKeySequence::AddTab,this); closeTabS = new QShortcut(QKeySequence::Close,this); + prevTabS = new QShortcut(QKeySequence::PreviousChild,this); + nextTabS = new QShortcut(QKeySequence::NextChild,this); + //Print out all the keyboard shortcuts onto the screen + qDebug() << "New Tab Shortcut:" << QKeySequence::keyBindings(QKeySequence::AddTab); + qDebug() << "Close Tab Shortcut:" << QKeySequence::keyBindings(QKeySequence::Close); + qDebug() << "Next Tab Shortcut:" << QKeySequence::keyBindings(QKeySequence::NextChild); + qDebug() << "Previous Tab Shortcut:" << QKeySequence::keyBindings(QKeySequence::PreviousChild); //Connect the signals/slots connect(tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(Close_Tab(int)) ); + connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(focusOnWidget()) ); connect(closeTabS, SIGNAL(activated()), this, SLOT(Close_Tab()) ); connect(newTabS, SIGNAL(activated()), this, SLOT(New_Tab()) ); connect(hideS, SIGNAL(activated()), this, SLOT(HideWindow()) ); connect(closeS, SIGNAL(activated()), this, SLOT(CloseWindow()) ); + connect(prevTabS, SIGNAL(activated()), this, SLOT(Prev_Tab()) ); + connect(nextTabS, SIGNAL(activated()), this, SLOT(Next_Tab()) ); //Now set the defaults screennum = 0; //default value @@ -83,6 +93,8 @@ void TermWindow::OpenDirs(QStringList dirs){ QString ID = GenerateTabID(); page->setWhatsThis(ID); tabWidget->addTab(page, ID); + tabWidget->setCurrentWidget(page); + page->setFocus(); qDebug() << "New Tab:" << ID << dirs[i]; connect(page, SIGNAL(ProcessClosed(QString)), this, SLOT(Close_Tab(QString)) ); } @@ -117,7 +129,7 @@ void TermWindow::ShowWindow(){ ANIM->setStartValue( QRect(this->x(), this->geometry().bottom(), this->width(), 0) ); //same location - no height } this->show(); - qDebug() << "Start Animation" << ANIM->startValue() << ANIM->endValue(); + //qDebug() << "Start Animation" << ANIM->startValue() << ANIM->endValue(); ANIM->start(); } @@ -202,7 +214,7 @@ void TermWindow::Close_Tab(int tab){ //qDebug() << "Close Tab:" << tab; if(tab<0){ tab = tabWidget->currentIndex(); } static_cast<TerminalWidget*>(tabWidget->widget(tab))->aboutToClose(); - delete tabWidget->widget(tab); //delete the page within the tag + tabWidget->widget(tab)->deleteLater(); //delete the page within the tag tabWidget->removeTab(tab); // remove the tab itself //Make sure there is always at least one tab if(tabWidget->count() < 1){ @@ -221,6 +233,26 @@ void TermWindow::Close_Tab(QString ID){ } } +void TermWindow::Next_Tab(){ + qDebug() << "Next Tab"; + int next = tabWidget->currentIndex()+1; + if(next>=tabWidget->count()){ next = 0; } + tabWidget->setCurrentIndex(next); +} + +void TermWindow::Prev_Tab(){ + qDebug() << "Previous Tab"; + int next = tabWidget->currentIndex()-1; + if(next<0){ next = tabWidget->count()-1; } + tabWidget->setCurrentIndex(next); +} + +void TermWindow::focusOnWidget(){ + if(tabWidget->currentWidget()!=0){ + tabWidget->currentWidget()->setFocus(); + } +} + //Animation finishing void TermWindow::AnimFinished(){ if(animRunning <0){ return; } //nothing running diff --git a/desktop-utilities/lumina-terminal/TermWindow.h b/desktop-utilities/lumina-terminal/TermWindow.h index 135da0ef..d68c5457 100644 --- a/desktop-utilities/lumina-terminal/TermWindow.h +++ b/desktop-utilities/lumina-terminal/TermWindow.h @@ -36,7 +36,7 @@ public slots: private: QTabWidget *tabWidget; QSettings *settings; - QShortcut *hideS, *closeS, *newTabS, *closeTabS; + QShortcut *hideS, *closeS, *newTabS, *closeTabS, *prevTabS, *nextTabS; int screennum; bool onTop, CLOSING; QPropertyAnimation *ANIM; @@ -51,7 +51,9 @@ private slots: void New_Tab(); void Close_Tab(int tab = -1); void Close_Tab(QString ID); //alternate form of the close routine - based on tab ID - + void Next_Tab(); + void Prev_Tab(); + void focusOnWidget(); //Animation finishing void AnimFinished(); diff --git a/desktop-utilities/lumina-terminal/TerminalWidget.cpp b/desktop-utilities/lumina-terminal/TerminalWidget.cpp index 9023b222..2ba4e7fa 100644 --- a/desktop-utilities/lumina-terminal/TerminalWidget.cpp +++ b/desktop-utilities/lumina-terminal/TerminalWidget.cpp @@ -12,6 +12,8 @@ #include <QScrollBar> #include <QTextBlock> +#include <LuminaXDG.h> + //Special control code ending symbols (aside from letters) //QByteArray CC_END_SYMBOLS("@"); @@ -19,10 +21,14 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent) //Setup the text widget this->setLineWrapMode(QTextEdit::WidgetWidth); this->setAcceptRichText(false); - //this->setOverwriteMode(true); + this->setOverwriteMode(true); + this->setFocusPolicy(Qt::StrongFocus); + this->setContextMenuPolicy(Qt::CustomContextMenu); //this->setStyleSheet(""); DEFFMT = this->textCursor().charFormat(); //save the default structure for later CFMT = this->textCursor().charFormat(); //current format + selCursor = this->textCursor(); //used for keeping track of selections + lastCursor = this->textCursor(); QFontDatabase FDB; QStringList fonts = FDB.families(QFontDatabase::Latin); for(int i=0; i<fonts.length(); i++){ @@ -35,7 +41,9 @@ TerminalWidget::TerminalWidget(QWidget *parent, QString dir) : QTextEdit(parent) bool ok = PROC->startTTY( QProcessEnvironment::systemEnvironment().value("SHELL","/bin/sh"), QStringList(), dir); qDebug() << " - opened:" << ok; this->setEnabled(PROC->isOpen()); - + 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()) ); //Connect the signals/slots connect(PROC, SIGNAL(readyRead()), this, SLOT(UpdateText()) ); connect(PROC, SIGNAL(processClosed()), this, SLOT(ShellClosed()) ); @@ -54,28 +62,28 @@ void TerminalWidget::aboutToClose(){ // PRIVATE // ================== void TerminalWidget::InsertText(QString txt){ - //qDebug() << "Insert Text:" << txt << "Cursor Pos:" << this->textCursor().position() << "Column:" << this->textCursor().columnNumber(); - QTextCursor cur(this->textCursor()); + if(txt.isEmpty()){ return; } + qDebug() << "Insert Text:" << txt << "Cursor Pos:" << this->textCursor().position() << "Column:" << this->textCursor().columnNumber(); + QTextCursor cur = this->textCursor(); cur.setCharFormat(CFMT); cur.insertText( txt, CFMT); - this->textCursor().swap(cur); + this->setTextCursor(cur); } void TerminalWidget::applyData(QByteArray 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 QByteArray chars; - qDebug() << "Data:" << data; + //qDebug() << "Data:" << data; for(int i=0; i<data.size(); i++){ if( data.at(i)=='\b' ){ //Flush current text buffer to widget - if(!chars.isEmpty()){ - chars.chop(1); - //InsertText(chars); chars.clear(); - }else{ - this->textCursor().deletePreviousChar(); - } - //Simple cursor backward 1 (NOT backspace in this context!!) - //this->moveCursor(QTextCursor::Left, QTextCursor::MoveAnchor); + //Simple cursor backward 1 (NOT backspace in this context!! - this widget should be in "insert" mode instead) + InsertText(chars); chars.clear(); + this->moveCursor(QTextCursor::Left, QTextCursor::MoveAnchor); + //}else if( data.at(i)=='\t' ){ + //chars.append(" "); }else if( data.at(i)=='\x1B' ){ //Flush current text buffer to widget if(!chars.isEmpty()){ InsertText(chars); chars.clear(); } @@ -107,59 +115,74 @@ void TerminalWidget::applyData(QByteArray data){ void TerminalWidget::applyANSI(QByteArray code){ //Note: the first byte is often the "[" character - //qDebug() << "Handle ANSI:" << code; + qDebug() << "Handle ANSI:" << code; //CURSOR MOVEMENT if( code.endsWith("A") ){ //Move Up int num = 1; if(code.size()>2){ num = code.mid(1, code.size()-2).toInt(); } //everything in the middle - this->textCursor().movePosition(QTextCursor::Up, QTextCursor::MoveAnchor, num); + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::Up, QTextCursor::MoveAnchor, num); + this->setTextCursor(cur); }else if(code.endsWith("B")){ //Move Down int num = 1; if(code.size()>2){ num = code.mid(1, code.size()-2).toInt(); } //everything in the middle - this->textCursor().movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, num); + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, num); + this->setTextCursor(cur); }else if(code.endsWith("C")){ //Move Forward int num = 1; if(code.size()>2){ num = code.mid(1, code.size()-2).toInt(); } //everything in the middle - for(int i=0; i<num; i++){ this->moveCursor(QTextCursor::Right, QTextCursor::MoveAnchor); } - //this->textCursor().movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, num); + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, num); + this->setTextCursor(cur); }else if(code.endsWith("D")){ //Move Back int num = 1; if(code.size()>2){ num = code.mid(1, code.size()-2).toInt(); } //everything in the middle - for(int i=0; i<num; i++){ this->moveCursor(QTextCursor::Left, QTextCursor::MoveAnchor); } - //this->textCursor().movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, num); - }else if(code.endsWith("E")){ //Move Next/down Lines (go to beginning) + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, num); + this->setTextCursor(cur); + }else if(code.endsWith("E")){ //Move Next/down Lines (go toward end) int num = 1; if(code.size()>2){ num = code.mid(1, code.size()-2).toInt(); } //everything in the middle - this->textCursor().movePosition(QTextCursor::NextRow, QTextCursor::MoveAnchor, num); + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::NextRow, QTextCursor::MoveAnchor, num); + this->setTextCursor(cur); }else if(code.endsWith("F")){ //Move Previous/up Lines (go to beginning) int num = 1; if(code.size()>2){ num = code.mid(1, code.size()-2).toInt(); } //everything in the middle - this->textCursor().movePosition(QTextCursor::PreviousRow, QTextCursor::MoveAnchor, num); + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::PreviousRow, QTextCursor::MoveAnchor, num); + this->setTextCursor(cur); }else if(code.endsWith("G")){ //Move to specific column int num = 1; if(code.size()>2){ num = code.mid(1, code.size()-2).toInt(); } //everything in the middle - this->textCursor().setPosition(num); + QTextCursor cur = this->textCursor(); + cur.setPosition(num); + this->setTextCursor(cur); }else if(code.endsWith("H") || code.endsWith("f") ){ //Move to specific position (row/column) int mid = code.indexOf(";"); - if(mid>0){ + if(mid>1){ int numR, numC; numR = numC = 1; - if(mid >=3){ numR = code.mid(1,mid-1).toInt()/this->fontMetrics().lineSpacing(); } + if(mid >=3){ numR = code.mid(1,mid-1).toInt(); } if(mid < code.size()-1){ numC = code.mid(mid+1,code.size()-mid-2).toInt(); } qDebug() << "Set Text Position (absolute):" << "Code:" << code << "Row:" << numR << "Col:" << numC; - qDebug() << " - Current Pos:" << this->textCursor().position() << "Line Count:" << this->document()->lineCount(); + //qDebug() << " - Current Pos:" << this->textCursor().position() << "Line Count:" << this->document()->lineCount(); //if(!this->textCursor().movePosition(QTextCursor::Start, QTextCursor::MoveAnchor,1) ){ qDebug() << "Could not go to start"; } QTextCursor cur(this->textCursor()); - cur.setPosition(0, QTextCursor::MoveAnchor); //go to start of document - qDebug() << " - Pos After Start Move:" << cur.position(); + cur.setPosition(QTextCursor::Start, QTextCursor::MoveAnchor); //go to start of document + //qDebug() << " - Pos After Start Move:" << cur.position(); if( !cur.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor, numR) ){ qDebug() << "Could not go to row:" << numR; } - qDebug() << " - Pos After Down Move:" << cur.position(); + //qDebug() << " - Pos After Down Move:" << cur.position(); if( !cur.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, numC) ){ qDebug() << "Could not go to col:" << numC; } /*this->textCursor().setPosition( this->document()->findBlockByLineNumber(numR).position() ); qDebug() << " - Pos After Row Move:" << this->textCursor().position(); if( !this->textCursor().movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, numC) ){ qDebug() << "Could not go to col:" << numC; }*/ qDebug() << " - Ending Pos:" << cur.position(); this->setTextCursor(cur); + }else{ + //Go to home position + this->moveCursor(QTextCursor::Start); } // DISPLAY CLEAR CODES @@ -169,18 +192,20 @@ void TerminalWidget::applyANSI(QByteArray code){ //qDebug() << "Erase Display:" << num; if(num==1){ //Clear from cursor to beginning of screen - for(int i=this->textCursor().position(); i>=0; i--){ - this->textCursor().deletePreviousChar(); - } + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::Start, QTextCursor::KeepAnchor, 1); + cur.removeSelectedText(); + this->setTextCursor(cur); }else if(num==2){ //Clear the whole screen qDebug() << "Clear Screen:" << this->document()->lineCount(); this->clear(); }else{ //Clear from cursor to end of screen - for(int i=this->textCursor().position(); i<this->document()->characterCount()+1; i++){ - this->textCursor().deleteChar(); - } + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::End, QTextCursor::KeepAnchor, 1); + cur.removeSelectedText(); + this->setTextCursor(cur); } }else if(code.endsWith("K")){ //EL - Erase in Line int num = 0; @@ -189,24 +214,23 @@ void TerminalWidget::applyANSI(QByteArray code){ //Now determine what should be cleared based on code if(num==1){ //Clear from current cursor to beginning of line - for(int i=this->textCursor().position(); i>=0; i--){ - if(this->document()->characterAt(this->textCursor().position())=='\n'){ break; } - this->textCursor().deleteChar(); - } + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::StartOfLine, QTextCursor::KeepAnchor, 1); + cur.removeSelectedText(); + this->setTextCursor(cur); }else if(num==2){ //Clear the entire line - // rewind the starting point to the beginning of the line - int start = this->document()->find("\n", this->textCursor().position(), QTextDocument::FindBackward).position(); - for(int i=start+1; i<this->document()->characterCount()+1; i++){ - if(this->document()->characterAt(this->textCursor().position())=='\n'){ break; } - this->textCursor().deleteChar(); - } + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::StartOfLine, QTextCursor::MoveAnchor, 1); + cur.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor, 1); + cur.removeSelectedText(); + this->setTextCursor(cur); }else{ //Clear from current cursor to end of line - for(int i=this->textCursor().position(); i<this->document()->characterCount()+1; i++){ - if(this->document()->characterAt(this->textCursor().position())=='\n'){ break; } - this->textCursor().deleteChar(); - } + QTextCursor cur = this->textCursor(); + cur.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor, 1); + cur.removeSelectedText(); + this->setTextCursor(cur); } //SCROLL MOVEMENT CODES @@ -314,6 +338,9 @@ QBrush brush = CFMT.background(); //Outgoing Data parsing void TerminalWidget::sendKeyPress(int key){ QByteArray ba; + QString cCol = QString::number(this->textCursor().columnNumber()); //current column number + QString cLine = QString::number(this->document()->toPlainText().left(this->textCursor().position()).count("\n")); + QString maxCol = QString::number( this->document()->toPlainText().section("\n",cLine.toInt(), cLine.toInt()).length()-1); //Check for special keys switch(key){ case Qt::Key_Delete: @@ -334,9 +361,17 @@ void TerminalWidget::sendKeyPress(int key){ case Qt::Key_Down: ba.append("\x1b[B"); break; + case Qt::Key_Home: + ba.append( "\x1b[" ); //+cLine+";0H").toLocal8Bit().data() ); + ba.append( cLine.toLocal8Bit().data() ); + ba.append(";0H"); + break; + case Qt::Key_End: + ba.append( QString("\x1b["+cLine+";"+maxCol+"H").toLocal8Bit().data() ); + break; } - //qDebug() << "Forward Input:" << txt << ev->key() << ba; + qDebug() << "Forward Input:" << ba; if(!ba.isEmpty()){ PROC->writeTTY(ba); } } @@ -356,6 +391,18 @@ void TerminalWidget::ShellClosed(){ emit ProcessClosed(this->whatsThis()); } +void TerminalWidget::copySelection(){ + QApplication::clipboard()->setText( selCursor.selectedText() ); +} + +void TerminalWidget::pasteSelection(){ + QString text = QApplication::clipboard()->text(); + if(!text.isEmpty()){ + QByteArray ba; ba.append(text); //avoid any byte conversions + PROC->writeTTY(ba); + } +} + // ================== // PROTECTED // ================== @@ -375,19 +422,39 @@ void TerminalWidget::mousePressEvent(QMouseEvent *ev){ this->setFocus(); if(ev->button()==Qt::RightButton){ QTextEdit::mousePressEvent(ev); + }else if(ev->button()==Qt::MiddleButton){ + pasteSelection(); + }else if(ev->button()==Qt::LeftButton){ + lastCursor = this->textCursor(); + selCursor = this->cursorForPosition(ev->pos()); }else{ Q_UNUSED(ev); } } -void TerminalWidget::mouseDoubleClickEvent(QMouseEvent *ev){ - Q_UNUSED(ev); +void TerminalWidget::mouseMoveEvent(QMouseEvent *ev){ + if(ev->button()==Qt::LeftButton){ + selCursor.setPosition(this->cursorForPosition(ev->pos()).position(), QTextCursor::KeepAnchor); + this->setTextCursor(selCursor); + }else{ + QTextEdit::mouseMoveEvent(ev); + } +} +void TerminalWidget::mouseReleaseEvent(QMouseEvent *ev){ + if(ev->button()==Qt::LeftButton){ + selCursor.setPosition(this->cursorForPosition(ev->pos()).position(), QTextCursor::KeepAnchor); + this->setTextCursor(selCursor); + }else if(ev->button()==Qt::RightButton){ + copyA->setEnabled( selCursor.hasSelection() ); + pasteA->setEnabled( !QApplication::clipboard()->text().isEmpty() ); + contextMenu->popup( this->mapToGlobal(ev->pos()) ); + }else{ + Q_UNUSED(ev); + } } -void TerminalWidget::contextMenuEvent(QContextMenuEvent *ev){ +void TerminalWidget::mouseDoubleClickEvent(QMouseEvent *ev){ Q_UNUSED(ev); - //QTextEdit::contextMenuEvent(ev); - //Need to implement a custom context menu } void TerminalWidget::resizeEvent(QResizeEvent *ev){ diff --git a/desktop-utilities/lumina-terminal/TerminalWidget.h b/desktop-utilities/lumina-terminal/TerminalWidget.h index f0c84013..c3cef93e 100644 --- a/desktop-utilities/lumina-terminal/TerminalWidget.h +++ b/desktop-utilities/lumina-terminal/TerminalWidget.h @@ -12,6 +12,8 @@ #include <QResizeEvent> #include <QSocketNotifier> #include <QTimer> +#include <QMenu> +#include <QClipboard> #include "TtyProcess.h" @@ -26,6 +28,10 @@ public: private: TTYProcess *PROC; QTextCharFormat DEFFMT, CFMT; //default/current text format + QTextCursor selCursor, lastCursor; + QMenu *contextMenu; + QAction *copyA, *pasteA; + int selectionStart; //Incoming Data parsing void InsertText(QString); @@ -40,14 +46,19 @@ private slots: void UpdateText(); void ShellClosed(); + void copySelection(); + void pasteSelection(); + signals: void ProcessClosed(QString); protected: void keyPressEvent(QKeyEvent *ev); void mousePressEvent(QMouseEvent *ev); + void mouseMoveEvent(QMouseEvent *ev); + void mouseReleaseEvent(QMouseEvent *ev); void mouseDoubleClickEvent(QMouseEvent *ev); - void contextMenuEvent(QContextMenuEvent *ev); + //void contextMenuEvent(QContextMenuEvent *ev); void resizeEvent(QResizeEvent *ev); }; diff --git a/desktop-utilities/lumina-terminal/TrayIcon.cpp b/desktop-utilities/lumina-terminal/TrayIcon.cpp index 4519e5e5..ea970df9 100644 --- a/desktop-utilities/lumina-terminal/TrayIcon.cpp +++ b/desktop-utilities/lumina-terminal/TrayIcon.cpp @@ -53,12 +53,12 @@ void TrayIcon::parseInputs(QStringList inputs){ // ================= void TrayIcon::slotSingleInstance(QStringList inputs){ //Note that this is only run for a secondary process forwarding its inputs - qDebug() << "Single Instance Event:" << inputs << termVisible; + //qDebug() << "Single Instance Event:" << inputs << termVisible; bool visible = termVisible; inputs = adjustInputs(inputs); //will adjust termVisible as necessary if(!inputs.isEmpty()){ TERM->OpenDirs(inputs); } //Only adjust the window if there was a change in the visibility status - qDebug() << "Set Visible:" << termVisible; + //qDebug() << "Set Visible:" << termVisible; if(!visible && termVisible){ QTimer::singleShot(0, TERM, SLOT(ShowWindow())); } else if(visible && !termVisible){ QTimer::singleShot(0, TERM, SLOT(HideWindow())); } } diff --git a/desktop-utilities/lumina-terminal/TtyProcess.cpp b/desktop-utilities/lumina-terminal/TtyProcess.cpp index 7a68a7d1..542af93d 100644 --- a/desktop-utilities/lumina-terminal/TtyProcess.cpp +++ b/desktop-utilities/lumina-terminal/TtyProcess.cpp @@ -18,8 +18,10 @@ bool TTYProcess::startTTY(QString prog, QStringList args, QString workdir){ if(workdir=="~"){ workdir = QDir::homePath(); } QDir::setCurrent(workdir); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); - setenv("TERM","lumina-terminal",1); - setenv("TERMCAP","",1); //see /etc/termcap as well + setenv("TERM","vt102",1); //VT102 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*/ QStringList filter = env.keys().filter("XTERM"); for(int i=0; i<filter.length(); i++){ unsetenv(filter[i].toLocal8Bit().data()); } //if(env.contains("TERM")){ unsetenv("TERM"); } diff --git a/desktop-utilities/lumina-terminal/lumina-terminal.pro b/desktop-utilities/lumina-terminal/lumina-terminal.pro index ee10bcd8..104ff33f 100644 --- a/desktop-utilities/lumina-terminal/lumina-terminal.pro +++ b/desktop-utilities/lumina-terminal/lumina-terminal.pro @@ -1,17 +1,9 @@ -TEMPLATE = app -LANGUAGE = C++ +include("$${PWD}/../../OS-detect.pri") + QT += core gui widgets network -CONFIG += qt warn_on release -isEmpty(PREFIX) { - PREFIX = /usr/local -} TARGET = lumina-terminal -target.path = $$DESTDIR$$PREFIX/bin - -isEmpty(LIBPREFIX) { - LIBPREFIX = $$PREFIX/lib -} +target.path = $${L_BINDIR} HEADERS += TrayIcon.h \ TermWindow.h \ @@ -25,17 +17,9 @@ SOURCES += main.cpp \ TtyProcess.cpp -INCLUDEPATH += ../../libLumina $$PREFIX/include -LIBS += -L../../libLumina -L$$LIBPREFIX -lLuminaUtils -lc - -isEmpty(QT5LIBDIR) { - QT5LIBDIR = $$PREFIX/lib/qt5 -} - -LRELEASE = $$QT5LIBDIR/bin/lrelease +LIBS += -lLuminaUtils -QMAKE_LIBDIR = ../libLumina DEPENDPATH += ../../libLumina TRANSLATIONS = i18n/lumina-terminal_af.ts \ @@ -101,8 +85,8 @@ TRANSLATIONS = i18n/lumina-terminal_af.ts \ i18n/lumina-terminal_zh_TW.ts \ i18n/lumina-terminal_zu.ts -dotrans.path=$$PREFIX/share/Lumina-DE/i18n/ -dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$$PREFIX/share/Lumina-DE/i18n/ +dotrans.path=$${L_SHAREDIR}/Lumina-DE/i18n/ +dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$${L_SHAREDIR}/Lumina-DE/i18n/ INSTALLS += target dotrans |