git askpass for linux

This commit is contained in:
Roy Qu 2022-02-26 18:50:07 +08:00
parent ad20f8df3f
commit 6a622f907e
10 changed files with 168 additions and 2 deletions

View File

@ -588,7 +588,11 @@ QString GitManager::runGit(const QString& workingFolder, const QStringList &args
// qDebug()<<args;
QProcessEnvironment env;
env.insert("PATH",pSettings->dirs().appDir());
#ifdef Q_OS_WIN
env.insert("GIT_ASKPASS",includeTrailingPathDelimiter(pSettings->dirs().appDir())+"redpanda-win-git-askpass.exe");
#else
env.insert("GIT_ASKPASS",includeTrailingPathDelimiter(pSettings->dirs().appDir())+"redpanda-git-askpass.exe");
#endif
QString output = runAndGetOutput(
fileInfo.absoluteFilePath(),
workingFolder,

View File

@ -10,6 +10,11 @@ SUBDIRS += \
redpanda-win-git-askpass
}
linux: {
SUBDIRS += \
redpanda-git-askpass
}
APP_NAME = RedPandaCPP
APP_VERSION = 0.14.4

View File

@ -7,9 +7,9 @@ test -n $TMP_FOLDER | rm -rf $TMP_FOLDER
test -z $TMP_FOLDER | mkdir $TMP_FOLDER
cp -r packages/debian $TMP_FOLDER
cp -r astyle $TMP_FOLDER
cp -r redpanda-git-askpass $TMP_FOLDER
cp -r consolepauser $TMP_FOLDER
cp -r RedPandaIDE $TMP_FOLDER
cp README.md $TMP_FOLDER

View File

@ -1,3 +1,9 @@
redpanda-cpp (0.14.4-1) unstable; urgency=medium
* Update to 0.14.4
-- Roy Qu (瞿华) <royqh1979@gmail.com> Sat, 26 Feb 2022 18:48:00 +0800
redpanda-cpp (0.14.2-1) unstable; urgency=medium
* Update to 0.14.2

View File

@ -0,0 +1,37 @@
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::Dialog)
{
ui->setupUi(this);
}
Dialog::~Dialog()
{
delete ui;
}
int Dialog::showPrompt(const QString &prompt)
{
ui->txtPrompt->setText(prompt);
return exec();
}
QString Dialog::getInput()
{
return ui->txtInput->text();
}
void Dialog::on_txtInput_returnPressed()
{
if (!ui->txtInput->text().isEmpty())
accept();
}
void Dialog::closeEvent(QCloseEvent *event)
{
reject();
}

View File

@ -0,0 +1,30 @@
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
QT_BEGIN_NAMESPACE
namespace Ui { class Dialog; }
QT_END_NAMESPACE
class Dialog : public QDialog
{
Q_OBJECT
public:
Dialog(QWidget *parent = nullptr);
~Dialog();
int showPrompt(const QString& prompt);
QString getInput();
private slots:
void on_txtInput_returnPressed();
private:
Ui::Dialog *ui;
// QWidget interface
protected:
void closeEvent(QCloseEvent *event) override;
};
#endif // DIALOG_H

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>417</width>
<height>110</height>
</rect>
</property>
<property name="windowTitle">
<string>Git Ask Pass</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="txtPrompt">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="txtInput"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,18 @@
#include "dialog.h"
#include <QApplication>
#include <stdio.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
if (argc>1) {
Dialog w;
if (w.showPrompt(argv[1])==QDialog::Accepted) {
char* input = w.getInput().toLocal8Bit().data();
printf(input);
}
}
return 0;
}

View File

@ -0,0 +1,31 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
isEmpty(APP_NAME) {
APP_NAME = RedPandaCPP
}
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
dialog.cpp
HEADERS += \
dialog.h
FORMS += \
dialog.ui
isEmpty(PREFIX) {
PREFIX = /usr/local
}
# Default rules for deployment.
qnx: target.path = $${PREFIX}/libexec/$${APP_NAME}
else: unix:!android: target.path = $${PREFIX}/libexec/$${APP_NAME}
!isEmpty(target.path): INSTALLS += target

View File

@ -4,6 +4,10 @@ CONFIG -= app_bundle
CONFIG -= qt
DEFINES -= UNICODE
isEmpty(APP_NAME) {
APP_NAME = RedPandaCPP
}
SOURCES += \
main.c