diff options
author | JT Pennington <jt@obs-sec.com> | 2016-12-22 12:54:27 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-22 12:54:27 -0500 |
commit | e78fefc9e727a93e33b48e2c5ee1b1a99f480242 (patch) | |
tree | 33e6926989ea7c517426feebb89c366200da0fe0 /src-qt5/desktop-utils | |
parent | fix pages.pri (diff) | |
parent | Fix an issue with ZFS snapshot finding where the directory path of interest n... (diff) | |
download | lumina-e78fefc9e727a93e33b48e2c5ee1b1a99f480242.tar.gz lumina-e78fefc9e727a93e33b48e2c5ee1b1a99f480242.tar.bz2 lumina-e78fefc9e727a93e33b48e2c5ee1b1a99f480242.zip |
Merge branch 'master' into master
Diffstat (limited to 'src-qt5/desktop-utils')
10 files changed, 269 insertions, 167 deletions
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(); } 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; i<mntpoints.length(); i++){ - if(dirpath == mntpoints[i]){ mnt = mntpoints[i]; break; } - else if(dirpath.startsWith(mntpoints[i]) && mntpoints[i].length()>mnt.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 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(){ 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..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 @@ -59,52 +59,52 @@ <message> <location filename="../BrowserWidget.cpp" line="210"/> <source>Name</source> - <translation type="unfinished">Nom</translation> + <translation>Nom</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="211"/> <source>Size</source> - <translation type="unfinished">Mida</translation> + <translation>Mida</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="212"/> <source>Type</source> - <translation type="unfinished">Tipus</translation> + <translation>Tipus</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="213"/> <source>Date Modified</source> - <translation type="unfinished">Data de modificació</translation> + <translation>Data de modificació</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="214"/> <source>Date Created</source> - <translation type="unfinished">Data de creació:</translation> + <translation>Data de creació</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="316"/> <source>Capacity: %1</source> - <translation type="unfinished">Capacitat: %1</translation> + <translation>Capacitat: %1</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="342"/> <source>Files: %1 (%2)</source> - <translation type="unfinished">Fitxers: %1 (%2)</translation> + <translation>Fitxers: %1 (%2)</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="344"/> <source>Files: %1</source> - <translation type="unfinished"></translation> + <translation>Fitxers: %1</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="350"/> <source>Dirs: %1</source> - <translation type="unfinished">Directoris: %1</translation> + <translation>Directoris: %1</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="362"/> <source>No Directory Contents</source> - <translation type="unfinished"></translation> + <translation>No hi ha contingut de directori</translation> </message> </context> <context> @@ -117,12 +117,12 @@ <message> <location filename="../widgets/DirWidget2.ui" line="145"/> <source>Increase Icon Sizes</source> - <translation type="unfinished"></translation> + <translation>Augmenta la mida de les icones</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="161"/> <source>Decrease Icon Sizes</source> - <translation type="unfinished"></translation> + <translation>Disminueix la mida de les icones</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="179"/> @@ -160,32 +160,32 @@ <message> <location filename="../widgets/DirWidget2.ui" line="218"/> <source>Menu</source> - <translation type="unfinished"></translation> + <translation>Menú</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="221"/> <source>Select Action</source> - <translation type="unfinished"></translation> + <translation>Seleccioneu l'acció</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="229"/> <source>SingleColumn</source> - <translation type="unfinished"></translation> + <translation>Una columna</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="232"/> <source>Single column view</source> - <translation type="unfinished"></translation> + <translation>Vista d'una columna</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="240"/> <source>Dual Column</source> - <translation type="unfinished"></translation> + <translation>Dues columnes</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="243"/> <source>Dual Column View</source> - <translation type="unfinished"></translation> + <translation>Vista de dues columnes</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="525"/> @@ -213,7 +213,7 @@ <message> <location filename="../widgets/DirWidget2.cpp" line="563"/> <source>The document could not be created. Please ensure that you have the proper permissions.</source> - <translation>No s'ha pogut crear el document. Si us plau, assegureu-vos que teniu els permisos adients.</translation> + <translation>No s'ha pogut crear el document. Si us plau, assegureu-vos que teniu els permisos adients.</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="571"/> @@ -230,17 +230,17 @@ <message> <location filename="../widgets/DirWidget2.cpp" line="488"/> <source>File Operations</source> - <translation type="unfinished"></translation> + <translation>Operacions de fitxers</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="495"/> <source>Directory Operations</source> - <translation type="unfinished"></translation> + <translation>Operacions de directoris</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="507"/> <source>Loading...</source> - <translation type="unfinished"></translation> + <translation>Carregant...</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="554"/> @@ -257,7 +257,7 @@ <message> <location filename="../widgets/DirWidget2.cpp" line="585"/> <source>The directory could not be created. Please ensure that you have the proper permissions to modify the current directory.</source> - <translation>No s'ha pogut crear el directori. Si us plau, assegureu-vos que teniu els permisos corresponents per modificar el directori actual.</translation> + <translation>No s'ha pogut crear el directori. Si us plau, assegureu-vos que teniu els permisos corresponents per modificar el directori actual.</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="313"/> @@ -267,62 +267,62 @@ <message> <location filename="../widgets/DirWidget2.cpp" line="229"/> <source>Create...</source> - <translation type="unfinished"></translation> + <translation>Crea...</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="231"/> <source>File</source> - <translation type="unfinished">Fitxer</translation> + <translation>Fitxer</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="232"/> <source>Directory</source> - <translation type="unfinished"></translation> + <translation>Directori</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="233"/> <source>Application Launcher</source> - <translation type="unfinished"></translation> + <translation>Llançador d'aplicacions</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="237"/> <source>Launch...</source> - <translation type="unfinished"></translation> + <translation>Obre...</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="239"/> <source>Terminal</source> - <translation type="unfinished"></translation> + <translation>Terminal</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="240"/> <source>SlideShow</source> - <translation type="unfinished"></translation> + <translation>Presentació</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="241"/> <source>Multimedia Player</source> - <translation type="unfinished"></translation> + <translation>Reproductor multimèdia</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="245"/> <source>Modify Files...</source> - <translation type="unfinished"></translation> + <translation>Modifica els fitxers...</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="256"/> <source>View Files...</source> - <translation type="unfinished"></translation> + <translation>Mostra els fitxers...</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="258"/> <source>Checksums</source> - <translation type="unfinished"></translation> + <translation>Sumes de verificació</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="260"/> <source>Properties</source> - <translation type="unfinished"></translation> + <translation>Propietats</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="448"/> @@ -336,8 +336,8 @@ </message> <message> <location filename="../widgets/DirWidget2.cpp" line="460"/> - <source>The "lumina-fileinfo" utility could not be found on the system. Please install it first.</source> - <translation>No s'ha pogut trobar la utilitat "lumina-fileinfo" al sistema. Si us plau, instal·leu-la primer.</translation> + <source>The "lumina-fileinfo" utility could not be found on the system. Please install it first.</source> + <translation>No s'ha pogut trobar la utilitat "lumina-fileinfo" al sistema. Si us plau, instal·leu-la primer.</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="485"/> @@ -410,7 +410,7 @@ <message> <location filename="../FODialog.cpp" line="131"/> <source>Note: It will just add a number to the filename otherwise.</source> - <translation>Nota: si no, només s'afegirà un número al nom del fitxer.</translation> + <translation>Nota: si no, només s'afegirà un número al nom del fitxer.</translation> </message> <message> <location filename="../FODialog.cpp" line="148"/> @@ -435,22 +435,22 @@ <message> <location filename="../FODialog.cpp" line="164"/> <source>Could not remove these files:</source> - <translation>No s'han pogut suprimir aquests fitxers:</translation> + <translation>No s'han pogut suprimir aquests fitxers:</translation> </message> <message> <location filename="../FODialog.cpp" line="165"/> <source>Could not copy these files:</source> - <translation>No s'han pogut copiar aquests fitxers:</translation> + <translation>No s'han pogut copiar aquests fitxers:</translation> </message> <message> <location filename="../FODialog.cpp" line="166"/> <source>Could not restore these files:</source> - <translation>No s'han pogut restaurar aquests fitxers:</translation> + <translation>No s'han pogut restaurar aquests fitxers:</translation> </message> <message> <location filename="../FODialog.cpp" line="167"/> <source>Could not move these files:</source> - <translation>No s'han pogut moure aquests fitxers:</translation> + <translation>No s'han pogut moure aquests fitxers:</translation> </message> <message> <location filename="../FODialog.cpp" line="169"/> @@ -471,7 +471,7 @@ Old Location: %1 New Location: %2</source> - <translation>No és possible moure un directori a dins de si mateix. Si us plau, en comptes d'això, feu-ne una còpia. + <translation>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</translation> @@ -492,7 +492,7 @@ Localització nova: %2</translation> <message> <location filename="../gitWizard.ui" line="27"/> <source>This wizard will guide you through the process of downloading a GIT repository from the internet.</source> - <translation>Aquest assistent us guiarà a través del procés de baixada d'un repositori GIT des d'Internet.</translation> + <translation>Aquest assistent us guiarà a través del procés de baixada d'un repositori GIT des d'Internet.</translation> </message> <message> <location filename="../gitWizard.ui" line="46"/> @@ -517,7 +517,7 @@ Localització nova: %2</translation> <message> <location filename="../gitWizard.ui" line="89"/> <source>Type of Access</source> - <translation>Tipus d'accés</translation> + <translation>Tipus d'accés</translation> </message> <message> <location filename="../gitWizard.ui" line="95"/> @@ -532,7 +532,7 @@ Localització nova: %2</translation> <message> <location filename="../gitWizard.ui" line="114"/> <source>Username</source> - <translation>Nom d'usuari</translation> + <translation>Nom d'usuari</translation> </message> <message> <location filename="../gitWizard.ui" line="124"/> @@ -571,8 +571,8 @@ Localització nova: %2</translation> </message> <message> <location filename="../gitWizard.ui" line="232"/> - <source>Click "Next" to start downloading the repository</source> - <translation>Cliqueu a "Següent" per començar a baixar el repositori</translation> + <source>Click "Next" to start downloading the repository</source> + <translation>Cliqueu a "Següent" per començar a baixar el repositori</translation> </message> <message> <location filename="../gitWizard.h" line="57"/> @@ -620,7 +620,7 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.ui" line="142"/> <source>Bookmarks</source> - <translation>Adreces d'interès</translation> + <translation>Adreces d'interès</translation> </message> <message> <location filename="../MainUI.ui" line="150"/> @@ -635,7 +635,7 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.ui" line="171"/> <source>New Tab</source> - <translation type="unfinished"></translation> + <translation>Pestanya nova</translation> </message> <message> <location filename="../MainUI.ui" line="174"/> @@ -690,7 +690,7 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.ui" line="326"/> <source>Add Bookmark</source> - <translation>Afegeix una adreça d'interès</translation> + <translation>Afegeix una adreça d'interès</translation> </message> <message> <location filename="../MainUI.ui" line="329"/> @@ -715,7 +715,7 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.ui" line="403"/> <source>Close Tab</source> - <translation type="unfinished"></translation> + <translation>Tanca la pestanya</translation> </message> <message> <location filename="../MainUI.ui" line="414"/> @@ -760,12 +760,12 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.ui" line="220"/> <source>Manage Bookmarks</source> - <translation>Gestiona les adreces d'interès / marcadors</translation> + <translation>Gestiona les adreces d'interès / marcadors</translation> </message> <message> <location filename="../MainUI.ui" line="234"/> <source>Show Action Buttons</source> - <translation>Mostra els botons d'acció</translation> + <translation>Mostra els botons d'acció</translation> </message> <message> <location filename="../MainUI.ui" line="245"/> @@ -845,7 +845,7 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.cpp" line="185"/> <source>The following directories are invalid and could not be opened:</source> - <translation>Els directoris següents no són vàlids i no s'han pogut obrir:</translation> + <translation>Els directoris següents no són vàlids i no s'han pogut obrir:</translation> </message> <message> <location filename="../MainUI.cpp" line="329"/> @@ -865,7 +865,7 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.cpp" line="588"/> <source>New Bookmark</source> - <translation>Adreça d'interès nova</translation> + <translation>Adreça d'interès nova</translation> </message> <message> <location filename="../MainUI.cpp" line="588"/> @@ -880,7 +880,7 @@ Localització nova: %2</translation> <message> <location filename="../MainUI.cpp" line="593"/> <source>This bookmark name already exists. Please choose another.</source> - <translation>Aquest nom d'adreça d'interès ja existeix. Trieu-ne un altre.</translation> + <translation>Aquest nom d'adreça d'interès ja existeix. Trieu-ne un altre.</translation> </message> <message> <location filename="../MainUI.cpp" line="614"/> @@ -1001,43 +1001,43 @@ Localització nova: %2</translation> <message> <location filename="../OPWidget.ui" line="14"/> <source>Form</source> - <translation type="unfinished">Formulari</translation> + <translation>Formulari</translation> </message> <message> <location filename="../OPWidget.ui" line="44"/> <location filename="../OPWidget.ui" line="51"/> <source>...</source> - <translation type="unfinished">...</translation> + <translation>...</translation> </message> <message> <location filename="../OPWidget.ui" line="60"/> <source>Evaluating...</source> - <translation type="unfinished"></translation> + <translation>Avaluant...</translation> </message> <message> <location filename="../OPWidget.cpp" line="48"/> <source>Move</source> - <translation type="unfinished"></translation> + <translation>Mou</translation> </message> <message> <location filename="../OPWidget.cpp" line="49"/> <source>Copy</source> - <translation type="unfinished"></translation> + <translation>Copia</translation> </message> <message> <location filename="../OPWidget.cpp" line="50"/> <source>Remove</source> - <translation type="unfinished"></translation> + <translation>Suprimeix</translation> </message> <message> <location filename="../OPWidget.cpp" line="99"/> <source>%1 Finished</source> - <translation type="unfinished"></translation> + <translation>%1 acabat</translation> </message> <message> <location filename="../OPWidget.cpp" line="99"/> <source>Errors Occured</source> - <translation type="unfinished"></translation> + <translation>Hi ha hagut errors</translation> </message> </context> <context> @@ -1050,17 +1050,17 @@ Localització nova: %2</translation> <message> <location filename="../widgets/SlideshowWidget.ui" line="36"/> <source>Delete this image file</source> - <translation>Suprimeix aquest fitxer d'imatge</translation> + <translation>Suprimeix aquest fitxer d'imatge</translation> </message> <message> <location filename="../widgets/SlideshowWidget.ui" line="56"/> <source>Rotate this image file counter-clockwise</source> - <translation>Gira aquest fitxer d'imatge cap a l'esquerra</translation> + <translation>Gira aquest fitxer d'imatge cap a l'esquerra</translation> </message> <message> <location filename="../widgets/SlideshowWidget.ui" line="69"/> <source>Rotate this image file clockwise</source> - <translation>Gira aquest fitxer d'imatge cap a la dreta</translation> + <translation>Gira aquest fitxer d'imatge cap a la dreta</translation> </message> <message> <location filename="../widgets/SlideshowWidget.ui" line="89"/> @@ -1148,17 +1148,17 @@ Localització nova: %2</translation> <message> <location filename="../TrayUI.cpp" line="71"/> <source>Finished</source> - <translation type="unfinished">Acabat</translation> + <translation>Acabat</translation> </message> <message> <location filename="../TrayUI.cpp" line="71"/> <source>Errors during operation. Click to view details</source> - <translation type="unfinished"></translation> + <translation>Hi ha hagut errors durant l'operació. Cliqueu aquí per veure'n els detalls.</translation> </message> <message> <location filename="../TrayUI.cpp" line="71"/> <source>No Errors</source> - <translation type="unfinished"></translation> + <translation>Sense errors</translation> </message> </context> </TS> 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 @@ <message> <location filename="../BrowserWidget.cpp" line="210"/> <source>Name</source> - <translation type="unfinished">Pavadinimas</translation> + <translation>Pavadinimas</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="211"/> <source>Size</source> - <translation type="unfinished">Dydis</translation> + <translation>Dydis</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="212"/> <source>Type</source> - <translation type="unfinished">Tipas</translation> + <translation>Tipas</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="213"/> <source>Date Modified</source> - <translation type="unfinished">Keitimo data</translation> + <translation>Keitimo data</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="214"/> <source>Date Created</source> - <translation type="unfinished">Sukūrimo data</translation> + <translation>Sukūrimo data</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="316"/> <source>Capacity: %1</source> - <translation type="unfinished">Talpa: %1</translation> + <translation>Talpa: %1</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="342"/> <source>Files: %1 (%2)</source> - <translation type="unfinished">Failai: %1 (%2)</translation> + <translation>Failai: %1 (%2)</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="344"/> <source>Files: %1</source> - <translation type="unfinished"></translation> + <translation>Failai: %1</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="350"/> <source>Dirs: %1</source> - <translation type="unfinished">Katalogai: %1</translation> + <translation>Katalogai: %1</translation> </message> <message> <location filename="../BrowserWidget.cpp" line="362"/> <source>No Directory Contents</source> - <translation type="unfinished"></translation> + <translation>Nėra katalogo turinio</translation> </message> </context> <context> @@ -117,12 +117,12 @@ <message> <location filename="../widgets/DirWidget2.ui" line="145"/> <source>Increase Icon Sizes</source> - <translation type="unfinished"></translation> + <translation>Padidinti piktogramų dydį</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="161"/> <source>Decrease Icon Sizes</source> - <translation type="unfinished"></translation> + <translation>Sumažinti piktogramų dydį</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="179"/> @@ -160,7 +160,7 @@ <message> <location filename="../widgets/DirWidget2.ui" line="218"/> <source>Menu</source> - <translation type="unfinished"></translation> + <translation>Meniu</translation> </message> <message> <location filename="../widgets/DirWidget2.ui" line="221"/> @@ -230,17 +230,17 @@ <message> <location filename="../widgets/DirWidget2.cpp" line="488"/> <source>File Operations</source> - <translation type="unfinished"></translation> + <translation>Failų operacijos</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="495"/> <source>Directory Operations</source> - <translation type="unfinished"></translation> + <translation>Katalogų operacijos</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="507"/> <source>Loading...</source> - <translation type="unfinished"></translation> + <translation>Įkeliama...</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="554"/> @@ -267,7 +267,7 @@ <message> <location filename="../widgets/DirWidget2.cpp" line="229"/> <source>Create...</source> - <translation type="unfinished"></translation> + <translation>Sukurti...</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="231"/> @@ -317,12 +317,12 @@ <message> <location filename="../widgets/DirWidget2.cpp" line="258"/> <source>Checksums</source> - <translation type="unfinished"></translation> + <translation>Kontrolinės sumos</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="260"/> <source>Properties</source> - <translation type="unfinished"></translation> + <translation>Savybės</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="448"/> @@ -336,8 +336,8 @@ </message> <message> <location filename="../widgets/DirWidget2.cpp" line="460"/> - <source>The "lumina-fileinfo" utility could not be found on the system. Please install it first.</source> - <translation>Sistemoje nepavyko rasti "lumina-fileinfo" paslaugų programos. Prašome, iš pradžių, ją įdiegti.</translation> + <source>The "lumina-fileinfo" utility could not be found on the system. Please install it first.</source> + <translation>Sistemoje nepavyko rasti "lumina-fileinfo" paslaugų programos. Prašome, iš pradžių, ją įdiegti.</translation> </message> <message> <location filename="../widgets/DirWidget2.cpp" line="485"/> @@ -571,8 +571,8 @@ Nauja vieta: %2</translation> </message> <message> <location filename="../gitWizard.ui" line="232"/> - <source>Click "Next" to start downloading the repository</source> - <translation>Spustelėkite "Kitas", kad pradėtumėte saugyklos atsisiuntimą</translation> + <source>Click "Next" to start downloading the repository</source> + <translation>Spustelėkite "Kitas", kad pradėtumėte saugyklos atsisiuntimą</translation> </message> <message> <location filename="../gitWizard.h" line="57"/> @@ -635,7 +635,7 @@ Nauja vieta: %2</translation> <message> <location filename="../MainUI.ui" line="171"/> <source>New Tab</source> - <translation type="unfinished"></translation> + <translation>Nauja kortelė</translation> </message> <message> <location filename="../MainUI.ui" line="174"/> @@ -715,7 +715,7 @@ Nauja vieta: %2</translation> <message> <location filename="../MainUI.ui" line="403"/> <source>Close Tab</source> - <translation type="unfinished"></translation> + <translation>Užverti kortelę</translation> </message> <message> <location filename="../MainUI.ui" line="414"/> @@ -1001,13 +1001,13 @@ Nauja vieta: %2</translation> <message> <location filename="../OPWidget.ui" line="14"/> <source>Form</source> - <translation type="unfinished">Forma</translation> + <translation>Forma</translation> </message> <message> <location filename="../OPWidget.ui" line="44"/> <location filename="../OPWidget.ui" line="51"/> <source>...</source> - <translation type="unfinished">...</translation> + <translation>...</translation> </message> <message> <location filename="../OPWidget.ui" line="60"/> @@ -1017,17 +1017,17 @@ Nauja vieta: %2</translation> <message> <location filename="../OPWidget.cpp" line="48"/> <source>Move</source> - <translation type="unfinished"></translation> + <translation>Perkelti</translation> </message> <message> <location filename="../OPWidget.cpp" line="49"/> <source>Copy</source> - <translation type="unfinished"></translation> + <translation>Kopijuoti</translation> </message> <message> <location filename="../OPWidget.cpp" line="50"/> <source>Remove</source> - <translation type="unfinished"></translation> + <translation>Šalinti</translation> </message> <message> <location filename="../OPWidget.cpp" line="99"/> @@ -1148,17 +1148,17 @@ Nauja vieta: %2</translation> <message> <location filename="../TrayUI.cpp" line="71"/> <source>Finished</source> - <translation type="unfinished">Užbaigta</translation> + <translation>Užbaigta</translation> </message> <message> <location filename="../TrayUI.cpp" line="71"/> <source>Errors during operation. Click to view details</source> - <translation type="unfinished"></translation> + <translation>Klaidos operacijos metu. Spustelėkite, kad pamatytumėte išsamesnę informaciją</translation> </message> <message> <location filename="../TrayUI.cpp" line="71"/> <source>No Errors</source> - <translation type="unfinished"></translation> + <translation>Nėra klaidų</translation> </message> </context> </TS> diff --git a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp index 83474f04..906252cf 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TerminalWidget.cpp @@ -14,6 +14,8 @@ #include <LuminaXDG.h> +#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<QTextEdit::ExtraSelection> 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); } @@ -148,6 +164,10 @@ void TerminalWidget::applyANSI(QByteArray code){ else{ qDebug() << "Unhandled ANSI Code:" << code; } + + }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 @@ -279,7 +299,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; @@ -289,16 +320,22 @@ void TerminalWidget::applyANSI(QByteArray code){ // GRAPHICS RENDERING }else if(code.endsWith("m")){ //Format: "[<number>;<number>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); } @@ -353,11 +390,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 @@ -385,6 +422,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 @@ -395,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"); @@ -437,7 +475,6 @@ void TerminalWidget::UpdateText(){ applyData(PROC->readTTY()); //adjust the scrollbar as needed this->ensureCursorVisible(); - //this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum()); } void TerminalWidget::ShellClosed(){ @@ -458,6 +495,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 // ================== @@ -465,11 +512,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); @@ -521,12 +564,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 88eeb1ec..b6ef8f6d 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.cpp @@ -4,7 +4,7 @@ #include <QProcessEnvironment> #include <QTimer> -#define DEBUG 0 +#define DEBUG 1 TTYProcess::TTYProcess(QObject *parent) : QObject(parent){ childProc = 0; @@ -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"); + + //setenv("TERMINFO","/etc/termcap",0); + unsetenv("WINDOWID"); //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("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:\ @@ -42,7 +46,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<filter.length(); i++){ unsetenv(filter[i].toLocal8Bit().data()); } //if(env.contains("TERM")){ unsetenv("TERM"); } @@ -103,7 +107,7 @@ void TTYProcess::closeTTY(){ void TTYProcess::writeTTY(QByteArray output){ //qDebug() << "Write:" << output; static QList<QByteArray> 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()); } @@ -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; @@ -168,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; } @@ -178,7 +188,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,31 +242,47 @@ QByteArray TTYProcess::CleanANSI(QByteArray raw, bool &incomplete){ raw = raw.remove(index,1); index = raw.indexOf("\x07"); } + //VT220(?) print character code (cut out the code, leave the character) + index=raw.indexOf("\x1b[@"); + while(index>=0){ + raw = raw.remove(index,3); + index = raw.indexOf("\x1b[@"); + } //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"); } -//Terminal Status request + //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 } -//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"); + raw = raw.remove(index,3); + index = raw.indexOf("\x1b[c"); //Also send the proper reply to this identify request right away - writeTTY("\x1b[/Z"); + 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"); + }*/ + incomplete = false; return raw; } @@ -265,27 +290,35 @@ 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 + //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) + //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 - //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); ) - tcsetattr(fds, TCSANOW, &TSET); //apply the changed settings - + //Adjust the slave side mode to SANE + 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 @@ -298,14 +331,40 @@ 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); - } + }*/ //MASTER thread (or error) 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 c2b483a9..42684112 100644 --- a/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h +++ b/src-qt5/desktop-utils/lumina-terminal/TtyProcess.h @@ -32,6 +32,7 @@ #include <sys/types.h> #include <sys/wait.h> #include <signal.h> +#include <libutil.h> class TTYProcess : public QObject{ Q_OBJECT @@ -72,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); 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 \ |