aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils
diff options
context:
space:
mode:
authorWeblate <noreply@weblate.org>2016-09-16 19:38:09 +0000
committerWeblate <noreply@weblate.org>2016-09-16 19:38:09 +0000
commit531690a5121ed0393127eaa7506e57ae5097c338 (patch)
treea4a1eb081ea417d0bdc768d2cabc50d91770f319 /src-qt5/desktop-utils
parentTranslated using Weblate (lumina_CONFIG@fa (generated)) (diff)
parentAdd syntax highlighting for "shell" files (.sh) (diff)
downloadlumina-531690a5121ed0393127eaa7506e57ae5097c338.tar.gz
lumina-531690a5121ed0393127eaa7506e57ae5097c338.tar.bz2
lumina-531690a5121ed0393127eaa7506e57ae5097c338.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/MainUI.cpp27
-rw-r--r--src-qt5/desktop-utils/lumina-fm/MainUI.h26
-rw-r--r--src-qt5/desktop-utils/lumina-fm/MainUI.ui18
-rw-r--r--src-qt5/desktop-utils/lumina-fm/gitCompat.cpp45
-rw-r--r--src-qt5/desktop-utils/lumina-fm/gitCompat.h56
-rw-r--r--src-qt5/desktop-utils/lumina-fm/gitWizard.cpp138
-rw-r--r--src-qt5/desktop-utils/lumina-fm/gitWizard.h67
-rw-r--r--src-qt5/desktop-utils/lumina-fm/gitWizard.ui252
-rw-r--r--src-qt5/desktop-utils/lumina-fm/lumina-fm.pro11
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp62
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h2
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/tests/test.cpp3
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/tests/test.sh10
13 files changed, 688 insertions, 29 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
index ea176846..abe14c0d 100644
--- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
@@ -8,6 +8,8 @@
#include "ui_MainUI.h"
#include <QFileInfo>
+#include "gitCompat.h"
+#include "gitWizard.h"
#define DEBUG 0
@@ -21,6 +23,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
ui->setupUi(this);
+ ui->menuGit->setVisible( GIT::isAvailable() );
if(DEBUG){ qDebug() << "Initilization:"; }
settings = new QSettings( QSettings::UserScope, "lumina-desktop", "lumina-fm", this);
@@ -230,6 +233,10 @@ void MainUI::setupIcons(){
ui->actionManage_Bookmarks->setIcon( LXDG::findIcon("bookmarks-organize","") );
ui->actionAdd_Bookmark->setIcon( LXDG::findIcon("bookmark-new","") );
+ //GIT menu
+ ui->actionRepo_Status->setIcon( LXDG::findIcon("git","document-edit-verify") );
+ ui->actionClone_Repository->setIcon( LXDG::findIcon("git","download") );
+
// External Devices menu
ui->actionScan->setIcon( LXDG::findIcon("system-search","") );
}
@@ -606,6 +613,26 @@ void MainUI::CreateBookMark(){
RebuildBookmarksMenu();
}
+//Git Menu options
+void MainUI::on_menuGit_aboutToShow(){
+ QString dir = FindActiveBrowser()->currentDir();
+ bool inrepo = GIT::isRepo(dir);
+ ui->actionRepo_Status->setEnabled( inrepo );
+ ui->actionClone_Repository->setEnabled( !inrepo );
+}
+
+void MainUI::on_actionRepo_Status_triggered(){
+ QString status = GIT::status( FindActiveBrowser()->currentDir() );
+ QMessageBox::information(this, tr("Git Repository Status"), status);
+}
+
+void MainUI::on_actionClone_Repository_triggered(){
+ GitWizard *dlg = new GitWizard(this);
+ dlg->setWorkingDir( FindActiveBrowser()->currentDir() );
+ dlg->show();
+}
+
+
void MainUI::tabChanged(int tab){
if(tab<0){ tab = tabBar->currentIndex(); }
if(tab < 0){ return; }
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.h b/src-qt5/desktop-utils/lumina-fm/MainUI.h
index 007fff97..6df10a89 100644
--- a/src-qt5/desktop-utils/lumina-fm/MainUI.h
+++ b/src-qt5/desktop-utils/lumina-fm/MainUI.h
@@ -114,14 +114,14 @@ private slots:
void on_actionNew_Window_triggered();
void on_actionNew_Tab_triggered();
void on_actionSearch_triggered();
- void on_actionClose_Browser_triggered();
+ void on_actionClose_Browser_triggered();
void on_actionClose_triggered();
- void on_actionRename_triggered();
- void on_actionCut_Selection_triggered();
- void on_actionCopy_Selection_triggered();
- void on_actionPaste_triggered();
- void on_actionDelete_Selection_triggered();
- void on_actionRefresh_triggered();
+ void on_actionRename_triggered();
+ void on_actionCut_Selection_triggered();
+ void on_actionCopy_Selection_triggered();
+ void on_actionPaste_triggered();
+ void on_actionDelete_Selection_triggered();
+ void on_actionRefresh_triggered();
void on_actionView_Hidden_Files_triggered();
void on_actionShow_Action_Buttons_triggered();
void on_actionShow_Thumbnails_triggered();
@@ -132,15 +132,19 @@ private slots:
void on_actionLarger_Icons_triggered();
void on_actionSmaller_Icons_triggered();
void CreateBookMark();
-
+ //Git Menu options
+ void on_menuGit_aboutToShow();
+ void on_actionRepo_Status_triggered();
+ void on_actionClone_Repository_triggered();
+
//Tab interactions
- void tabChanged(int tab = -1);
+ void tabChanged(int tab = -1);
void tabClosed(int tab = -1);
void nextTab(); //For keyboard shortcuts
void prevTab(); //For keyboard shortcuts
- //Other Shortcuts
- void togglehiddenfiles();
+ //Other Shortcuts
+ void togglehiddenfiles();
void focusDirWidget();
//Backend Info passing
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.ui b/src-qt5/desktop-utils/lumina-fm/MainUI.ui
index 8078b804..3c11d87e 100644
--- a/src-qt5/desktop-utils/lumina-fm/MainUI.ui
+++ b/src-qt5/desktop-utils/lumina-fm/MainUI.ui
@@ -176,11 +176,19 @@
<addaction name="separator"/>
<addaction name="actionDelete_Selection"/>
</widget>
+ <widget class="QMenu" name="menuGit">
+ <property name="title">
+ <string>Git</string>
+ </property>
+ <addaction name="actionRepo_Status"/>
+ <addaction name="actionClone_Repository"/>
+ </widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
<addaction name="menuView"/>
<addaction name="menuBookmarks"/>
<addaction name="menuExternal_Devices"/>
+ <addaction name="menuGit"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionNew_Tab">
@@ -426,6 +434,16 @@
<enum>Qt::ApplicationShortcut</enum>
</property>
</action>
+ <action name="actionRepo_Status">
+ <property name="text">
+ <string>Repo Status</string>
+ </property>
+ </action>
+ <action name="actionClone_Repository">
+ <property name="text">
+ <string>Clone Repository</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
diff --git a/src-qt5/desktop-utils/lumina-fm/gitCompat.cpp b/src-qt5/desktop-utils/lumina-fm/gitCompat.cpp
new file mode 100644
index 00000000..18e83e6a
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/gitCompat.cpp
@@ -0,0 +1,45 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is the backend classe for interacting with the "git" utility
+//===========================================
+#include "gitCompat.h"
+#include <QApplication>
+
+#define TMPFILE QString("/tmp/.")
+GitProcess::GitProcess() : QProcess(){
+ this->setProcessChannelMode(QProcess::MergedChannels);
+ tmpfile.setFileName(TMPFILE +QString::number( (rand()%8999) + 1000 ));
+ //qDebug() << "Temporary File Name:" << tmpfile.fileName();
+ tmpfile.setParent(this);
+ connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(cleanup()) );
+ connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(printoutput()) );
+}
+
+GitProcess::~GitProcess(){
+ if(tmpfile.exists()){ tmpfile.remove(); } //ensure that password file never gets left behind
+}
+
+void GitProcess::setSSHPassword(QString pass){
+ //Save the password into the temporary file
+ if( tmpfile.open(QIODevice::WriteOnly) ){
+ QTextStream in(&tmpfile);
+ in << "#!/bin/sh"<<"\n";
+ in << "echo \""+pass+"\"" << "\n";
+ in << "rm "+tmpfile.fileName()+"\n"; //have the script clean itself up after running once
+ tmpfile.close();
+ }
+ tmpfile.setPermissions( QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner );
+ QApplication::processEvents();
+ QProcessEnvironment env = this->processEnvironment();
+ env.insert("SSH_ASKPASS", tmpfile.fileName());
+ env.insert("DISPLAY",":0"); //will not actually be used - the tmp file sends the password back instantly
+ this->setProcessEnvironment(env);
+}
+
+void GitProcess::cleanup(){
+ if(tmpfile.exists()){ tmpfile.remove(); } //ensure that password file never gets left behind
+}
diff --git a/src-qt5/desktop-utils/lumina-fm/gitCompat.h b/src-qt5/desktop-utils/lumina-fm/gitCompat.h
index 6578bd5b..3e6cb15e 100644
--- a/src-qt5/desktop-utils/lumina-fm/gitCompat.h
+++ b/src-qt5/desktop-utils/lumina-fm/gitCompat.h
@@ -4,23 +4,49 @@
// Available under the 3-clause BSD license
// See the LICENSE file for full details
//===========================================
-// This is the backend classe for interacting with the "git" utility
+// This is the backend class for interacting with the "git" utility
//===========================================
-#ifdef _LUMINA_FM_GIT_COMPAT_H
+#ifndef _LUMINA_FM_GIT_COMPAT_H
#define _LUMINA_FM_GIT_COMPAT_H
#include <QProcess>
#include <QString>
#include <QProcessEnvironment>
-
+#include <QDebug>
+#include <QTemporaryFile>
#include <LuminaUtils.h>
+#include <unistd.h>
+
+class GitProcess : public QProcess{
+ Q_OBJECT
+private:
+ QString log;
+ QFile tmpfile;
+public:
+ GitProcess();
+ ~GitProcess();
+
+ //Optional Inputs
+ void setSSHPassword(QString pass); //This is only used for SSH access
+
+private slots:
+ void cleanup();
+ //void printoutput(){ qDebug() << "Proc Output:" << this->readAllStandardOutput(); }
+
+protected:
+ virtual void setupChildProcess(){
+ //Need to disable the controlling terminal within this process
+ setsid(); //Make current process new session leader - resulting in no controlling terminal for this session
+ }
+};
+
class GIT{
public:
//Check if the git utility is installed and available
static bool isAvailable(){
- QString bin = "git"
- return isValidBinary(bin);
+ QString bin = "git";
+ return LUtils::isValidBinary(bin);
}
//Return if the current directory is a git repository
@@ -28,7 +54,8 @@ public:
QProcess P;
P.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
P.setWorkingDirectory(dir);
- P.exec("git",QStringList() <<"status" << "--porcelain" );
+ P.start("git",QStringList() <<"status" << "--porcelain" );
+ P.waitForFinished();
return (0==P.exitCode());
}
@@ -38,22 +65,23 @@ public:
P.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
P.setWorkingDirectory(dir);
P.setProcessChannelMode(QProcess::MergedChannels);
- P.exec("git",QStringList() <<"status" );
+ P.start("git",QStringList() <<"status" );
+ P.waitForFinished();
return P.readAllStandardOutput();
}
//Setup a process for running the clone operation (so the calling process can hook up any watchers and start it when ready)
- static QProcess setupClone(QString indir, QString url, QString branch = "", int depth = -1){
- QProcess P;
- P.setProcessEnvironment( QProcessEnvironment::systemEnvironment() );
- P.setWorkingDirectory(indir);
- P.setProgram("git");
+ static GitProcess* setupClone(QString indir, QString url, QString branch = "", int depth = -1){
+ //NOTE: The returned QProcess needs to be cleaned up when finished
+ GitProcess *P = new GitProcess();
+ P->setWorkingDirectory(indir);
+ P->setProgram("git");
QStringList args;
- args << "clone";
+ args << "clone" << "--progress";
if(!branch.isEmpty()){ args << "-b" << branch; }
if(depth>0){ args << "--depth" << QString::number(depth); }
args << url;
- P.setArguments(args);
+ P->setArguments(args);
return P;
}
};
diff --git a/src-qt5/desktop-utils/lumina-fm/gitWizard.cpp b/src-qt5/desktop-utils/lumina-fm/gitWizard.cpp
new file mode 100644
index 00000000..7edfc95f
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/gitWizard.cpp
@@ -0,0 +1,138 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is the dialog for cloning a git repository
+//===========================================
+#include "gitWizard.h"
+#include "ui_gitWizard.h"
+
+#include "gitCompat.h"
+#include <QDebug>
+#include <QThread>
+
+GitWizard::GitWizard(QWidget *parent) : QWizard(parent), ui(new Ui::GitWizard){
+ ui->setupUi(this); //load the designer form
+ proc = 0; //not initialized yet
+ connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged(int)) );
+ //connect(this, SIGNAL(finished(int)), this, SLOT(finished(int)) );
+ connect(ui->line_repo_org, SIGNAL(textChanged(const QString&)), this, SLOT(validateRepo()) );
+ connect(ui->line_repo_name, SIGNAL(textChanged(const QString&)), this, SLOT(validateRepo()) );
+ connect(ui->line_ssh_pass, SIGNAL(textChanged(const QString&)), this, SLOT(validateType()) );
+ connect(ui->line_user, SIGNAL(textChanged(const QString&)), this, SLOT(validateType()) );
+ connect(ui->line_pass, SIGNAL(textChanged(const QString&)), this, SLOT(validateType()) );
+ connect(ui->radio_type_ssh, SIGNAL(clicked()), this, SLOT(validateType()) );
+ connect(ui->radio_type_login, SIGNAL(clicked()), this, SLOT(validateType()) );
+ connect(ui->radio_type_anon, SIGNAL(clicked()), this, SLOT(validateType()) );
+ connect(ui->check_depth, SIGNAL(clicked()), this, SLOT(validateType()) );
+ connect(ui->check_branch, SIGNAL(clicked()), this, SLOT(validateType()) );
+ validateRepo();
+}
+
+GitWizard::~GitWizard(){
+ if(proc!=0){ proc->deleteLater(); }
+}
+
+//Input values;
+void GitWizard::setWorkingDir(QString path){
+ inDir = path;
+}
+
+//============
+// PRIVATE
+// ============
+QString GitWizard::assembleURL(){
+ QString repo = ui->line_repo_org->text()+"/"+ui->line_repo_name->text()+".git";
+ QString url;
+ if(ui->radio_type_ssh->isChecked()){ url = "git@github.com:"+repo; }
+ else if(ui->radio_type_anon->isChecked()){ url = "https://github.com/"+repo; }
+ else if(ui->radio_type_login->isChecked()){
+ url = "https://"+ui->line_user->text()+":"+ui->line_pass->text()+"@github.com/"+repo;
+ }
+
+ return url;
+}
+
+/*void GitWizard::showDownload(GitProcess *P){
+
+ //P->closeWriteChannel();
+ //P->closeReadChannel(GitProcess::StandardOutput);
+ //P->closeReadChannel(GitProcess::StandardError);
+ while(P->state()!=QProcess::NotRunning){
+ this->thread()->usleep(50000); //50 ms
+ QApplication::processEvents();
+ }
+ P->deleteLater();
+}*/
+
+//================
+// PRIVATE SLOTS
+// ================
+void GitWizard::pageChanged(int newpage){
+ //called when the "next" button is clicked
+ if(this->page(newpage)==ui->page_repo){
+ validateRepo();
+ }else if(this->page(newpage)==ui->page_type){
+ //Need to adjust items on this page based on info on last page
+ ui->radio_type_anon->setEnabled( !ui->check_privaterepo->isChecked() );
+ ui->radio_type_ssh->setEnabled( QFile::exists(QDir::homePath()+"/.ssh/id_rsa") ); //TODO - Disable for now until SSH passphrases can be used properly
+ //Now set the preferred type of login based on which are available
+ if(ui->radio_type_ssh->isEnabled()){ ui->radio_type_ssh->setChecked(true); } //SSH is preferred if that is available
+ else if(ui->radio_type_anon->isEnabled()){ ui->radio_type_anon->setChecked(true); } //anonymous next since it is a public repo - no creds really needed
+ else{ ui->radio_type_login->setChecked(true); }
+ //Clear any of the UI as needed
+ ui->line_user->clear(); ui->line_pass->clear(); ui->line_ssh_pass->clear();
+ validateType();
+ }else if(this->page(newpage)==ui->page_download){
+ qDebug() << "Run git clone";
+ QString url = assembleURL();
+ QString branch; if(ui->check_branch->isChecked()){ branch = ui->line_branch->text(); }
+ int depth = -1; if(ui->check_depth->isChecked()){ depth = ui->spin_depth->value(); }
+ proc = GIT::setupClone(inDir, url, branch, depth);
+ if(proc!=0){
+ connect(proc, SIGNAL(readyReadStandardOutput()), this, SLOT(readProc()) );
+ connect(proc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(procFinished(int)) );
+ if(ui->radio_type_ssh->isChecked()){
+ proc->setSSHPassword(ui->line_ssh_pass->text());
+ }
+ proc->start(QIODevice::ReadOnly);
+ this->button(QWizard::FinishButton)->setEnabled(false);
+ }
+ }
+}
+
+//Page validation slots
+void GitWizard::validateRepo(){
+ bool ok = !ui->line_repo_org->text().isEmpty() && !ui->line_repo_name->text().isEmpty();
+ this->button(QWizard::NextButton)->setEnabled(ok);
+}
+
+void GitWizard::validateType(){
+ bool ok = false;
+ //Check types first
+ if(ui->radio_type_login->isChecked()){ ok = !ui->line_user->text().isEmpty() && !ui->line_pass->text().isEmpty(); }
+ else{ ok = true; }
+ //Now check optional settings
+ if(ui->check_branch->isChecked()){ ok = ok && !ui->line_branch->text().isEmpty(); }
+ if(ui->check_branch->isChecked()){ ok = ok && !ui->line_branch->text().isEmpty(); }
+ //Now make interface boxes appear/disappear as needed
+ ui->line_ssh_pass->setVisible(ui->radio_type_ssh->isChecked());
+ ui->line_user->setVisible(ui->radio_type_login->isChecked());
+ ui->line_pass->setVisible(ui->radio_type_login->isChecked());
+ ui->spin_depth->setVisible(ui->check_depth->isChecked());
+ ui->line_branch->setVisible(ui->check_branch->isChecked());
+
+ //Update the button as needed
+ this->button(QWizard::NextButton)->setEnabled(ok);
+}
+
+void GitWizard::readProc(){
+ ui->text_procOutput->append( proc->readAllStandardOutput() );
+}
+
+void GitWizard::procFinished(int retcode){
+ this->button(QWizard::FinishButton)->setEnabled(true);
+}
+
diff --git a/src-qt5/desktop-utils/lumina-fm/gitWizard.h b/src-qt5/desktop-utils/lumina-fm/gitWizard.h
new file mode 100644
index 00000000..4a6ec2bc
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/gitWizard.h
@@ -0,0 +1,67 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2016, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This is the dialog for cloning a git repository
+//===========================================
+#ifndef _LUMINA_FM_GIT_DIALOG_H
+#define _LUMINA_FM_GIT_DIALOG_H
+
+#include <QWizard>
+#include <QString>
+#include <QMessageBox>
+
+#include "gitCompat.h"
+
+namespace Ui{
+ class GitWizard;
+};
+
+class GitWizard : public QWizard{
+ Q_OBJECT
+public:
+ GitWizard(QWidget *parent = 0);
+ ~GitWizard();
+
+ //Input values;
+ void setWorkingDir(QString path);
+
+private:
+ Ui::GitWizard *ui;
+ QString inDir;
+ GitProcess *proc;
+
+ QString assembleURL();
+ //void showDownload(GitProcess *P);
+
+private slots:
+ //Page Change slots
+ void pageChanged(int newpage); //called when the "next" button is clicked
+ //void finished(int); //called when the "finish" button is clicked
+
+ //Page validation slots
+ void validateRepo(); //for page_repo
+ void validateType(); //for page_type
+
+ //process output
+ void readProc();
+ void procFinished(int retcode);
+
+protected:
+ void closeEvent(QCloseEvent *ev){
+ //Make sure the process is not running first
+ if(proc!=0 && proc->state()!=QProcess::NotRunning){
+ ev->ignore();
+ if(QMessageBox::Yes == QMessageBox::question(this, tr("Stop Download?"), tr("Kill the current download?") ) ){
+ proc->kill();
+ }
+ }else{
+ QWizard::closeEvent(ev);
+ this->deleteLater(); //we need to clean this up completely
+ }
+ }
+};
+
+#endif
diff --git a/src-qt5/desktop-utils/lumina-fm/gitWizard.ui b/src-qt5/desktop-utils/lumina-fm/gitWizard.ui
new file mode 100644
index 00000000..0f5894b6
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/gitWizard.ui
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>GitWizard</class>
+ <widget class="QWizard" name="GitWizard">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>456</width>
+ <height>346</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Clone a Git Repository</string>
+ </property>
+ <property name="wizardStyle">
+ <enum>QWizard::ModernStyle</enum>
+ </property>
+ <property name="options">
+ <set>QWizard::NoBackButtonOnLastPage|QWizard::NoBackButtonOnStartPage|QWizard::NoCancelButtonOnLastPage</set>
+ </property>
+ <widget class="QWizardPage" name="page_repo">
+ <property name="title">
+ <string>Welcome!</string>
+ </property>
+ <property name="subTitle">
+ <string>This wizard will guide you through the process of downloading a GIT repository from the internet.</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>GitHub Repository Settings</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_2">
+ <property name="labelAlignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Organization/User</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="line_repo_org"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Repository Name</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLineEdit" name="line_repo_name"/>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="check_privaterepo">
+ <property name="text">
+ <string>Is Private Repository</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWizardPage" name="page_type">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Type of Access</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="radio_type_ssh">
+ <property name="text">
+ <string>Use my SSH Key</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QRadioButton" name="radio_type_login">
+ <property name="text">
+ <string>Login to server</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLineEdit" name="line_user">
+ <property name="placeholderText">
+ <string>Username</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="line_pass">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ <property name="placeholderText">
+ <string>Password</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QRadioButton" name="radio_type_anon">
+ <property name="text">
+ <string>Anonymous (public repositories only)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="line_ssh_pass">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ <property name="placeholderText">
+ <string>Optional SSH Password</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="title">
+ <string>Advanced Options</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout_3">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="check_depth">
+ <property name="text">
+ <string>Custom Depth</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="check_branch">
+ <property name="text">
+ <string>Single Branch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLineEdit" name="line_branch">
+ <property name="placeholderText">
+ <string>branch name</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QSpinBox" name="spin_depth">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="font">
+ <font>
+ <pointsize>11</pointsize>
+ <weight>50</weight>
+ <italic>true</italic>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Click &quot;Next&quot; to start downloading the repository</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWizardPage" name="page_download">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QTextEdit" name="text_procOutput">
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro
index e47ba2f6..91e2952c 100644
--- a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro
+++ b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro
@@ -15,7 +15,9 @@ SOURCES += main.cpp \
BMMDialog.cpp \
widgets/MultimediaWidget.cpp \
widgets/SlideshowWidget.cpp \
- widgets/DirWidget.cpp
+ widgets/DirWidget.cpp \
+ gitCompat.cpp \
+ gitWizard.cpp
HEADERS += MainUI.h \
FODialog.h \
@@ -25,14 +27,17 @@ HEADERS += MainUI.h \
widgets/DDListWidgets.h \
widgets/MultimediaWidget.h \
widgets/SlideshowWidget.h \
- widgets/DirWidget.h
+ widgets/DirWidget.h \
+ gitCompat.h \
+ gitWizard.h
FORMS += MainUI.ui \
FODialog.ui \
BMMDialog.ui \
widgets/MultimediaWidget.ui \
widgets/SlideshowWidget.ui \
- widgets/DirWidget.ui
+ widgets/DirWidget.ui \
+ gitWizard.ui
icons.files = Insight-FileManager.png
icons.path = $${L_SHAREDIR}/pixmaps
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
index 7dcad6c3..0edb2160 100644
--- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp
@@ -10,6 +10,7 @@ QStringList Custom_Syntax::availableRules(){
QStringList avail;
avail << "C++";
//avail << "Python";
+ avail << "Shell";
avail << "reST";
return avail;
}
@@ -40,6 +41,7 @@ QString Custom_Syntax::ruleForFile(QString filename){
QString suffix = filename.section(".",-1);
if(suffix=="cpp" || suffix=="hpp" || suffix=="c" || suffix=="h"){ return "C++"; }
//else if(suffix=="py" || suffix=="pyc"){ return "Python"; }
+ else if(suffix=="sh"){ return "Shell"; }
else if(suffix=="rst"){ return "reST"; }
return "";
}
@@ -101,6 +103,66 @@ void Custom_Syntax::loadRules(QString type){
srule.endPattern = QRegExp("\\*/");
splitrules << srule;
+ }else if(type=="Shell"){
+ //Keywords (standard Shell definitions)
+ QStringList keywords;
+ keywords << "alias" << "alloc" << "bg" << "bind" << " bindkey" << "break" \
+ << "breaksw"<<"builtins"<<"case"<<"cd"<<"chdir"<<"command"<<"complete"<<"continue"<<"default" \
+ <<"dirs"<<"do"<<"done"<<"echo"<<"echotc"<<"elif"<<"else"<<"end"<<"endif"<<"endsw"<<"esac"<<"eval" \
+ <<"exec"<<"exit"<<"export"<<"false"<<"fc"<<"fg"<<"filetest"<<"fi"<<"for"<<"foreach"<<"getopts" \
+ <<"glob"<<"goto"<<"hash"<<"hashstat"<<"history"<<"hup"<<"if"<<"jobid"<<"jobs"<<"kill"<<"limit" \
+ <<"local"<<"log"<<"login"<<"logout"<<"ls-F"<<"nice"<<"nohup"<<"notify"<<"onintr"<<"popd" \
+ <<"printenv"<<"printf"<<"pushd"<<"pwd"<<"read"<<"readonly"<<"rehash"<<"repeat"<<"return" \
+ <<"sched"<<"set"<<"setenv"<<"settc"<<"setty"<<"setvar"<<"shift"<<"source"<<"stop"<<"suspend" \
+ <<"switch"<<"telltc"<<"test"<<"then"<<"time"<<"times"<<"trap"<<"true"<<"type"<<"ulimit"<<"umask" \
+ <<"unalias"<<"uncomplete"<<"unhash"<<"unlimit"<<"unset"<<"unsetenv"<<"until"<<"wait" \
+ <<"where"<<"which"<<"while";
+
+ SyntaxRule rule;
+ rule.format.setForeground( QColor(settings->value("colors/keyword").toString()) );
+ rule.format.setFontWeight(QFont::Bold);
+ for(int i=0; i<keywords.length(); i++){
+ rule.pattern = QRegExp("\\b"+keywords[i]+"\\b"); //turn each keyword into a QRegExp and insert the rule
+ rules << rule;
+ }
+ //Alternate Keywords (built-in functions)
+ /*keywords.clear();
+ keywords << "for" << "while" << "switch" << "case" << "if" << "else" << "return" << "exit";
+ rule.format.setForeground( QColor(settings->value("colors/altkeyword").toString()) );
+ for(int i=0; i<keywords.length(); i++){
+ rule.pattern = QRegExp("\\b"+keywords[i]+"\\b"); //turn each keyword into a QRegExp and insert the rule
+ rules << rule;
+ }*/
+ //Variable Names
+ rule.format.setForeground( QColor(settings->value("colors/class").toString()) );
+ rule.pattern = QRegExp("\\$\\{[^\\n\\}]+\\}");
+ rules << rule;
+ rule.pattern = QRegExp("\\$[^\\s$]+(?=\\s|$)");
+ rules << rule;
+ //Quotes
+ rule.format.setForeground( QColor(settings->value("colors/text").toString()) );
+ rule.format.setFontWeight(QFont::Normal);
+ rule.pattern = QRegExp( "\"[^\"\\\\]*(\\\\(.|\\n)[^\"\\\\]*)*\"|'[^'\\\\]*(\\\\(.|\\n)[^'\\\\]*)*'");
+ rules << rule;
+ //Functions
+ rule.format.setForeground( QColor(settings->value("colors/function").toString()) );
+ rule.pattern = QRegExp("\\b[A-Za-z0-9_]+(?=\\()");
+ rules << rule;
+ //Proprocessor commands
+ rule.format.setForeground( QColor(settings->value("colors/preprocessor").toString()) );
+ rule.pattern = QRegExp("^#![^\n]*");
+ rules << rule;
+ //Comment (single line)
+ rule.format.setForeground( QColor(settings->value("colors/comment").toString()) );
+ rule.pattern = QRegExp("#[^\n]*");
+ rules << rule;
+ //Comment (multi-line)
+ //SyntaxRuleSplit srule;
+ //srule.format = rule.format; //re-use the single-line comment format
+ //srule.startPattern = QRegExp("/\\*");
+ //srule.endPattern = QRegExp("\\*/");
+ //splitrules << srule;
+
}else if(type=="Python"){
//Keywords
QStringList keywords;
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h
index 781ff65d..f834e275 100644
--- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h
+++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h
@@ -101,7 +101,7 @@ protected:
if(splitactive>=0 || index<start){ continue; } //skip this one - falls within a multi-line pattern above
while(index>=0){
int len = patt.matchedLength();
- setFormat(index, len, rules[i].format);
+ if(format(index)==currentBlock().charFormat()){ setFormat(index, len, rules[i].format); } //only apply highlighting if not within a section already
index = patt.indexIn(text, index+len); //go to the next match
}
}//end loop over normal (single-line) patterns
diff --git a/src-qt5/desktop-utils/lumina-textedit/tests/test.cpp b/src-qt5/desktop-utils/lumina-textedit/tests/test.cpp
index 1b50e302..e135227d 100644
--- a/src-qt5/desktop-utils/lumina-textedit/tests/test.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/tests/test.cpp
@@ -13,3 +13,6 @@ comment */
stuff
some /*single line comment with multi-line tags */
+
+"some text"
+"some text with url: http://sample.com"
diff --git a/src-qt5/desktop-utils/lumina-textedit/tests/test.sh b/src-qt5/desktop-utils/lumina-textedit/tests/test.sh
new file mode 100644
index 00000000..8eb7450c
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-textedit/tests/test.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+echo "some text" #with a comment
+for i in ["a","b","c"]
+do
+echo ${i}withsometext
+done
+
+variable$variable sdfgbuj
+variable${variable}satoibnsoin
bgstack15