mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-11 02:35:41 +03:00
Adds support for manually specifying SSH config and default keyfile paths
This commit is contained in:
parent
62a234bda1
commit
a04ba04b0a
BIN
rsrc/misc.png
Normal file
BIN
rsrc/misc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
91
rsrc/misc.svg
Normal file
91
rsrc/misc.svg
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
id="svg12"
|
||||||
|
height="64"
|
||||||
|
width="64"
|
||||||
|
version="1.1">
|
||||||
|
<metadata
|
||||||
|
id="metadata18">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs16" />
|
||||||
|
<rect
|
||||||
|
id="rect2"
|
||||||
|
fill="darkgray"
|
||||||
|
ry="6"
|
||||||
|
rx="6"
|
||||||
|
height="60"
|
||||||
|
width="60"
|
||||||
|
y="3"
|
||||||
|
x="3" />
|
||||||
|
<rect
|
||||||
|
style="fill:#623090;fill-opacity:1;stroke:#412060;stroke-opacity:1"
|
||||||
|
fill="slategray"
|
||||||
|
stroke="darkslategray"
|
||||||
|
stroke-width="1"
|
||||||
|
id="rect4"
|
||||||
|
ry="6"
|
||||||
|
rx="6"
|
||||||
|
height="60"
|
||||||
|
width="60"
|
||||||
|
y="1"
|
||||||
|
x="1" />
|
||||||
|
<g
|
||||||
|
style="stroke:#ffffff;stroke-opacity:1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none"
|
||||||
|
transform="translate(5.3754521,-16.5)"
|
||||||
|
id="g4642">
|
||||||
|
<circle
|
||||||
|
style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
|
||||||
|
id="path4620"
|
||||||
|
cx="38.290356"
|
||||||
|
cy="33"
|
||||||
|
r="7" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 14.041644,26 5.9587402,40 H 22.124548 Z"
|
||||||
|
id="path4635" />
|
||||||
|
<rect
|
||||||
|
style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
|
||||||
|
id="rect4616"
|
||||||
|
width="14"
|
||||||
|
height="14"
|
||||||
|
x="19.166"
|
||||||
|
y="47" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
transform="translate(2.7350731,-0.213627)"
|
||||||
|
id="g4653">
|
||||||
|
<circle
|
||||||
|
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
|
||||||
|
id="path4644"
|
||||||
|
cx="18.264927"
|
||||||
|
cy="53.213627"
|
||||||
|
r="2" />
|
||||||
|
<circle
|
||||||
|
r="2"
|
||||||
|
cy="53.213627"
|
||||||
|
cx="38.264927"
|
||||||
|
id="circle4646"
|
||||||
|
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
|
||||||
|
<circle
|
||||||
|
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal"
|
||||||
|
id="circle4648"
|
||||||
|
cx="28.264927"
|
||||||
|
cy="53.213627"
|
||||||
|
r="2" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 3.2 KiB |
BIN
rsrc/misc@2x.png
Normal file
BIN
rsrc/misc@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
@ -60,5 +60,7 @@
|
|||||||
<file>update@2x.png</file>
|
<file>update@2x.png</file>
|
||||||
<file>window.png</file>
|
<file>window.png</file>
|
||||||
<file>window@2x.png</file>
|
<file>window@2x.png</file>
|
||||||
|
<file>misc.png</file>
|
||||||
|
<file>misc@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -601,6 +601,30 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MiscPanel : public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MiscPanel(QWidget *parent = nullptr)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
Settings *settings = Settings::instance();
|
||||||
|
|
||||||
|
QLineEdit *sshConfigPathBox = new QLineEdit(settings->value("ssh/configFilePath").toString(), this);
|
||||||
|
connect(sshConfigPathBox, &QLineEdit::textChanged, [](const QString &text) {
|
||||||
|
Settings::instance()->setValue("ssh/configFilePath", text);
|
||||||
|
});
|
||||||
|
|
||||||
|
QLineEdit *sshKeyPathBox = new QLineEdit(settings->value("ssh/keyFilePath").toString(), this);
|
||||||
|
connect(sshKeyPathBox, &QLineEdit::textChanged, [](const QString &text) {
|
||||||
|
Settings::instance()->setValue("ssh/keyFilePath", text);
|
||||||
|
});
|
||||||
|
|
||||||
|
QFormLayout *layout = new QFormLayout(this);
|
||||||
|
layout->addRow(tr("Path to SSH config file:"), sshConfigPathBox);
|
||||||
|
layout->addRow(tr("Path to default / fallback SSH key file:"), sshKeyPathBox);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
class TerminalPanel : public QWidget
|
class TerminalPanel : public QWidget
|
||||||
{
|
{
|
||||||
@ -800,6 +824,14 @@ SettingsDialog::SettingsDialog(Index index, QWidget *parent)
|
|||||||
stack->addWidget(new TerminalPanel(this));
|
stack->addWidget(new TerminalPanel(this));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Add misc panel.
|
||||||
|
QAction *misc = toolbar->addAction(QIcon(":/misc.png"), tr("Misc"));
|
||||||
|
misc->setData(Misc);
|
||||||
|
misc->setActionGroup(actions);
|
||||||
|
misc->setCheckable(true);
|
||||||
|
|
||||||
|
stack->addWidget(new MiscPanel(this));
|
||||||
|
|
||||||
// Hook up edit button.
|
// Hook up edit button.
|
||||||
connect(edit, &QPushButton::clicked, stack, [stack] {
|
connect(edit, &QPushButton::clicked, stack, [stack] {
|
||||||
// Update on save.
|
// Update on save.
|
||||||
|
@ -24,7 +24,8 @@ public:
|
|||||||
Editor,
|
Editor,
|
||||||
Update,
|
Update,
|
||||||
Plugins,
|
Plugins,
|
||||||
Terminal
|
Terminal,
|
||||||
|
Misc
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsDialog(Index index, QWidget *parent = nullptr);
|
SettingsDialog(Index index, QWidget *parent = nullptr);
|
||||||
|
@ -38,6 +38,22 @@ const QStringList kKeyKinds = {"ed25519", "rsa", "dsa"};
|
|||||||
bool keyFile(QString &key)
|
bool keyFile(QString &key)
|
||||||
{
|
{
|
||||||
QDir dir = QDir::home();
|
QDir dir = QDir::home();
|
||||||
|
|
||||||
|
QString filePath = Settings::instance()->value("ssh/keyFilePath").toString();
|
||||||
|
if (!filePath.isEmpty()) {
|
||||||
|
QFileInfo file(filePath);
|
||||||
|
|
||||||
|
if (!file.isAbsolute())
|
||||||
|
file.setFile(dir.absolutePath() + '/' + file.filePath());
|
||||||
|
|
||||||
|
if (file.exists()) {
|
||||||
|
key = file.absoluteFilePath();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!dir.cd(".ssh"))
|
if (!dir.cd(".ssh"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -136,11 +152,22 @@ public:
|
|||||||
|
|
||||||
ConfigFile()
|
ConfigFile()
|
||||||
{
|
{
|
||||||
|
QString filePath = Settings::instance()->value("ssh/configFilePath").toString();
|
||||||
QDir dir = QDir::home();
|
QDir dir = QDir::home();
|
||||||
if (!dir.cd(".ssh"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
mFile.reset(new QFile(dir.filePath("config")));
|
if (filePath.isEmpty()) {
|
||||||
|
if (!dir.cd(".ssh"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
filePath = dir.absoluteFilePath("config");
|
||||||
|
}
|
||||||
|
|
||||||
|
QFileInfo file(filePath);
|
||||||
|
|
||||||
|
if (!file.isAbsolute())
|
||||||
|
file.setFile(dir.absolutePath() + '/' + file.filePath());
|
||||||
|
|
||||||
|
mFile.reset(new QFile(file.absoluteFilePath()));
|
||||||
if (!mFile->open(QFile::ReadOnly))
|
if (!mFile->open(QFile::ReadOnly))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user