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 <git2.h>
27
29{
30public:
31 DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository* aRepository,
32 wxString aURL = wxEmptyString );
33 ~DIALOG_GIT_REPOSITORY() override;
34
36 {
37 m_ConnType->SetSelection( static_cast<int>( aType ) );
39 }
40
42 {
43 return static_cast<KIGIT_COMMON::GIT_CONN_TYPE>( m_ConnType->GetSelection() );
44 }
45
46 wxString GetRepoName() const { return m_txtName->GetValue(); }
47
48 void SetRepoURL( const wxString& aURL ) { m_txtURL->SetValue( aURL ); }
49 wxString GetRepoURL() const { return m_txtURL->GetValue(); }
50
51 void SetUsername( const wxString& aUsername ) { m_txtUsername->SetValue( aUsername ); }
52
53 wxString GetUsername() const
54 {
56 return parsed.username.IsEmpty() ? m_txtUsername->GetValue() : parsed.username;
57 }
58
59 void SetPassword( const wxString& aPassword ) { m_txtPassword->SetValue( aPassword ); }
60 wxString GetPassword() const { return m_txtPassword->GetValue(); }
61
62 void SetRepoSSHPath( const wxString& aPath ) { m_fpSSHKey->SetFileName( aPath ); m_prevFile = aPath; }
63 wxString GetRepoSSHPath() const { return m_fpSSHKey->GetFileName().GetFullPath(); }
64
65 void SetEncrypted( bool aEncrypted = true );
66
67 void SetSkipButtonLabel( const wxString& aLabel )
68 {
70 {
71 m_sdbSizerCancel->SetLabel( aLabel );
72 m_sdbSizerCancel->Layout();
73 }
74 }
75
76protected:
77 virtual bool TransferDataToWindow() override;
78
79private:
80 void OnUpdateUI( wxUpdateUIEvent& event ) override;
81 void OnLocationExit( wxFocusEvent& event ) override;
82 void OnOKClick( wxCommandEvent& event ) override;
83
84 void OnSelectConnType( wxCommandEvent& event ) override;
85 void OnTestClick( wxCommandEvent& event ) override;
86
87 void OnFileUpdated( wxFileDirPickerEvent& event ) override;
88 void onCbCustom( wxCommandEvent& event ) override;
89
90 void setDefaultSSHKey( const wxString& aHost );
91
92 void updateAuthControls();
93 void updateURLData();
95
97 wxString m_incomeURL;
98
99 wxString m_prevFile;
100
102 wxString m_tempPath;
103};
104
105#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
void SetEncrypted(bool aEncrypted=true)
void OnLocationExit(wxFocusEvent &event) override
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)
A transport address with any embedded credentials extracted.