KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_git_repository.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef DIALOG_GIT_REPOSITORY_H_
21#define DIALOG_GIT_REPOSITORY_H_
22
24
26#include <git/kigit_ssh_keys.h>
27#include <git2.h>
28
30{
31public:
32 DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository* aRepository,
33 wxString aURL = wxEmptyString );
34 ~DIALOG_GIT_REPOSITORY() override;
35
37 {
38 m_ConnType->SetSelection( static_cast<int>( aType ) );
40 }
41
43 {
44 return static_cast<KIGIT_COMMON::GIT_CONN_TYPE>( m_ConnType->GetSelection() );
45 }
46
47 wxString GetRepoName() const { return m_txtName->GetValue(); }
48
49 void SetRepoURL( const wxString& aURL ) { m_txtURL->SetValue( aURL ); }
50 wxString GetRepoURL() const { return m_txtURL->GetValue(); }
51
52 void SetUsername( const wxString& aUsername ) { m_txtUsername->SetValue( aUsername ); }
53
54 wxString GetUsername() const
55 {
57 return parsed.username.IsEmpty() ? m_txtUsername->GetValue() : parsed.username;
58 }
59
60 void SetPassword( const wxString& aPassword ) { m_txtPassword->SetValue( aPassword ); }
61 wxString GetPassword() const { return m_txtPassword->GetValue(); }
62
63 void SetRepoSSHPath( const wxString& aPath ) { m_fpSSHKey->SetFileName( aPath ); }
65 wxString GetRepoSSHPath() const { return KIGIT::PrivateKeyPath( m_fpSSHKey->GetFileName().GetFullPath() ); }
66
67 void SetEncrypted( bool aEncrypted = true );
68
69 void SetSkipButtonLabel( const wxString& aLabel )
70 {
72 {
73 m_sdbSizerCancel->SetLabel( aLabel );
74 m_sdbSizerCancel->Layout();
75 }
76 }
77
78protected:
79 virtual bool TransferDataToWindow() override;
80
81private:
82 void OnUpdateUI( wxUpdateUIEvent& event ) override;
83 void OnLocationExit( wxFocusEvent& event ) override;
84 void OnOKClick( wxCommandEvent& event ) override;
85
86 void OnSelectConnType( wxCommandEvent& event ) override;
87 void OnTestClick( wxCommandEvent& event ) override;
88
89 void OnFileUpdated( wxFileDirPickerEvent& event ) override;
90 void onCbCustom( wxCommandEvent& event ) override;
91
92 void setDefaultSSHKey( const wxString& aHost );
93
95 bool reportUnusableKey();
96
97 void updateAuthControls();
98 void updateURLData();
100
102 wxString m_incomeURL;
103
105 wxString m_tempPath;
106};
107
108#endif /* DIALOG_GIT_REPOSITORY_H_ */
DIALOG_GIT_REPOSITORY_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Git Repository"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxCAPTION|wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
void OnSelectConnType(wxCommandEvent &event) override
void SetRepoType(KIGIT_COMMON::GIT_CONN_TYPE aType)
void SetRepoSSHPath(const wxString &aPath)
KIGIT_COMMON::GIT_CONN_TYPE GetRepoType() const
void OnFileUpdated(wxFileDirPickerEvent &event) override
void SetPassword(const wxString &aPassword)
void onCbCustom(wxCommandEvent &event) override
wxString GetRepoSSHPath() const
The private key, also when its .pub was picked.
void SetEncrypted(bool aEncrypted=true)
void OnLocationExit(wxFocusEvent &event) override
bool reportUnusableKey()
Show why the chosen SSH key cannot be used. False when there is no such problem.
DIALOG_GIT_REPOSITORY(wxWindow *aParent, git_repository *aRepository, wxString aURL=wxEmptyString)
void setDefaultSSHKey(const wxString &aHost)
void OnTestClick(wxCommandEvent &event) override
void SetRepoURL(const wxString &aURL)
void OnOKClick(wxCommandEvent &event) override
void SetUsername(const wxString &aUsername)
virtual bool TransferDataToWindow() override
void OnUpdateUI(wxUpdateUIEvent &event) override
void SetSkipButtonLabel(const wxString &aLabel)
static REMOTE_URL ParseRemoteURL(const wxString &aURL)
APIEXPORT wxString PrivateKeyPath(const wxString &aPicked)
The private key for a path picked in a file dialog, which may be the key's .pub file.
A transport address with any embedded credentials extracted.