aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2016-09-15 07:44:58 -0400
committerKen Moore <ken@pcbsd.org>2016-09-15 07:44:58 -0400
commit188efd21b0255be16813438ad593d098526a6745 (patch)
tree776a55dc95241ee7d91018789806d22d1a4b8c3e /src-qt5/desktop-utils
parentAdd the new Git cloning wizard to the source tree. This has not been tied int... (diff)
downloadlumina-188efd21b0255be16813438ad593d098526a6745.tar.gz
lumina-188efd21b0255be16813438ad593d098526a6745.tar.bz2
lumina-188efd21b0255be16813438ad593d098526a6745.zip
Add in the new Git Cloning Wizard. Now fully finished yet, but almost there.
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r--src-qt5/desktop-utils/lumina-fm/MainUI.cpp5
-rw-r--r--src-qt5/desktop-utils/lumina-fm/gitWizard.cpp81
-rw-r--r--src-qt5/desktop-utils/lumina-fm/gitWizard.h43
-rw-r--r--src-qt5/desktop-utils/lumina-fm/gitWizard.ui45
-rw-r--r--src-qt5/desktop-utils/lumina-fm/lumina-fm.pro9
5 files changed, 149 insertions, 34 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
index 0300438a..abe14c0d 100644
--- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp
@@ -9,6 +9,7 @@
#include <QFileInfo>
#include "gitCompat.h"
+#include "gitWizard.h"
#define DEBUG 0
@@ -626,7 +627,9 @@ void MainUI::on_actionRepo_Status_triggered(){
}
void MainUI::on_actionClone_Repository_triggered(){
-
+ GitWizard *dlg = new GitWizard(this);
+ dlg->setWorkingDir( FindActiveBrowser()->currentDir() );
+ dlg->show();
}
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..042f3c89
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/gitWizard.cpp
@@ -0,0 +1,81 @@
+//===========================================
+// 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>
+
+GitWizard::GitWizard(QWidget *parent) : QWizard(parent), ui(new Ui::GitWizard){
+ ui->setupUi(this); //load the designer form
+ connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(pageChanged(int)) );
+ connect(this, SIGNAL(finished(int)), this, SLOT(finished(int)) );
+}
+
+GitWizard::~GitWizard(){
+
+}
+
+//Input values;
+void GitWizard::setWorkingDir(QString path){
+ inDir = path;
+}
+
+//============
+// PRIVATE
+// ============
+QString GitWizard::assembleURL(){
+
+}
+
+void GitWizard::showDownload(QProcess *P){
+
+}
+
+//================
+// PRIVATE SLOTS
+// ================
+void GitWizard::pageChanged(int newpage){
+ //called when the "next" button is clicked
+ if(this->page(newpage)==ui->page_repo){
+
+ }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") );
+ //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();
+
+ }else{
+ //qDebug() << "Unknown page!" << newpage;
+ }
+}
+
+void GitWizard::finished(int res){
+ //called when the "finish" button is clicked:
+ // res==0: window closed (rejected state)
+ // res==1: "finish" clicked (accepted state)
+ //qDebug() << "Got Finished:" << res;
+ if(res == QDialog::Accepted){
+ qDebug() << "Run git clone";
+ QString url = assembleUrl();
+ QString branch; if(ui->check_brach->isChecked()){ branch = ui->line_branch->text(); }
+ int depth = -1; if(ui->check_depth->isChecked()){ depth = ui->spin_depth->value(); }
+ QProcess *proc = GIT::setupClone(inDir, url, branch, depth);
+ if(proc!=0){
+ showDownload(proc);
+ }
+ }
+
+ this->deleteLater();
+}
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..a95ecb2b
--- /dev/null
+++ b/src-qt5/desktop-utils/lumina-fm/gitWizard.h
@@ -0,0 +1,43 @@
+//===========================================
+// 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 <QProcess>
+
+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;
+
+ QString assembleURL();
+ void showDownload(QProcess *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
+
+};
+
+#endif
diff --git a/src-qt5/desktop-utils/lumina-fm/gitWizard.ui b/src-qt5/desktop-utils/lumina-fm/gitWizard.ui
index a576ef63..94aec4e0 100644
--- a/src-qt5/desktop-utils/lumina-fm/gitWizard.ui
+++ b/src-qt5/desktop-utils/lumina-fm/gitWizard.ui
@@ -13,33 +13,18 @@
<property name="windowTitle">
<string>Clone a Git Repository</string>
</property>
- <widget class="QWizardPage" name="wizardPage1">
+ <property name="wizardStyle">
+ <enum>QWizard::ModernStyle</enum>
+ </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>
- <widget class="QTextEdit" name="textEdit">
- <property name="styleSheet">
- <string notr="true">background: transparent;</string>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- <property name="html">
- <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
-&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
-p, li { white-space: pre-wrap; }
-&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
-&lt;p align=&quot;center&quot; style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Welcome!&lt;/span&gt;&lt;/p&gt;
-&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This wizard will guide you through the process of downloading a GIT repository from the internet.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -82,7 +67,7 @@ p, li { white-space: pre-wrap; }
<widget class="QLineEdit" name="lineEdit_3"/>
</item>
<item row="2" column="1">
- <widget class="QCheckBox" name="checkBox">
+ <widget class="QCheckBox" name="check_privaterepo">
<property name="text">
<string>Is Private Repository</string>
</property>
@@ -93,7 +78,7 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
- <widget class="QWizardPage" name="wizardPage2">
+ <widget class="QWizardPage" name="page_type">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
@@ -173,7 +158,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="1" column="0">
- <widget class="QCheckBox" name="checkBox_3">
+ <widget class="QCheckBox" name="check_branch">
<property name="text">
<string>Single Branch</string>
</property>
@@ -182,7 +167,7 @@ p, li { white-space: pre-wrap; }
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QLineEdit" name="lineEdit">
+ <widget class="QLineEdit" name="line_branch">
<property name="placeholderText">
<string>branch name</string>
</property>
@@ -193,7 +178,7 @@ p, li { white-space: pre-wrap; }
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
- <widget class="QSpinBox" name="spinBox">
+ <widget class="QSpinBox" name="spin_depth">
<property name="minimum">
<number>1</number>
</property>
diff --git a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro
index 7876af64..56314ee6 100644
--- a/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro
+++ b/src-qt5/desktop-utils/lumina-fm/lumina-fm.pro
@@ -15,7 +15,8 @@ SOURCES += main.cpp \
BMMDialog.cpp \
widgets/MultimediaWidget.cpp \
widgets/SlideshowWidget.cpp \
- widgets/DirWidget.cpp
+ widgets/DirWidget.cpp \
+ gitWizard.cpp
HEADERS += MainUI.h \
FODialog.h \
@@ -26,14 +27,16 @@ HEADERS += MainUI.h \
widgets/MultimediaWidget.h \
widgets/SlideshowWidget.h \
widgets/DirWidget.h \
- gitCompat.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
bgstack15