KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_git_remote.cpp
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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
21
22#include <confirm.h>
23
24
25DIALOG_GIT_REMOTE::DIALOG_GIT_REMOTE( wxWindow* aParent, const wxString& aName, const wxString& aUrl ) :
26 DIALOG_GIT_REMOTE_BASE( aParent, wxID_ANY, aName.IsEmpty() ? _( "Add Remote" ) : _( "Edit Remote" ) )
27{
28 OptOut( this );
29
30 m_nameCtrl->SetValue( aName );
31 m_urlCtrl->SetValue( aUrl );
32
33 if( !aName.IsEmpty() )
34 {
35 m_nameCtrl->Disable();
36 m_urlCtrl->SetFocus();
37 }
38
41}
42
43
45{
46 m_name = m_nameCtrl->GetValue();
47 m_name.Trim( true ).Trim( false );
48 m_url = m_urlCtrl->GetValue();
49 m_url.Trim( true ).Trim( false );
50
51 if( m_name.IsEmpty() )
52 {
53 DisplayInfoMessage( this, _( "Enter a name for the remote." ) );
54 m_nameCtrl->SetFocus();
55 return false;
56 }
57
58 if( m_url.IsEmpty() )
59 {
60 DisplayInfoMessage( this, _( "Enter the remote's URL." ) );
61 m_urlCtrl->SetFocus();
62 return false;
63 }
64
65 return true;
66}
DIALOG_GIT_REMOTE_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Add Remote"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE)
bool TransferDataFromWindow() override
DIALOG_GIT_REMOTE(wxWindow *aParent, const wxString &aName=wxEmptyString, const wxString &aUrl=wxEmptyString)
With aName set the remote exists already, so only its URL can be changed.
void OptOut(wxWindow *aWindow)
Opt out of control state saving.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition confirm.cpp:245
This file is part of the common library.
#define _(s)