diff options
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/MainUI.cpp | 5 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/gitWizard.cpp | 81 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/gitWizard.h | 43 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/gitWizard.ui | 45 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/lumina-fm.pro | 9 |
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><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Welcome!</span></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This wizard will guide you through the process of downloading a GIT repository from the internet.</p></body></html></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 |