KiCad PCB EDA Suite
Loading...
Searching...
No Matches
git_ui_utils.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 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
20#ifndef GIT_UI_UTILS_H
21#define GIT_UI_UTILS_H
22
23#include <mutex>
24#include <vector>
25
26class KIGIT_COMMON;
29class wxButton;
30class wxDateTime;
31class wxListCtrl;
32class wxSplitterWindow;
33class wxString;
34class wxWindow;
35
36namespace KIGIT
37{
38
40void ShowBusyMessage( wxWindow* aParent );
41
44[[nodiscard]] std::unique_lock<std::mutex> TryLockAction( KIGIT_COMMON& aCommon, wxWindow* aParent );
45
48[[nodiscard]] std::unique_lock<std::mutex> WaitForActionLock( KIGIT_COMMON& aCommon, wxWindow* aParent );
49
52void SortBranchesForDisplay( std::vector<KIGIT_BRANCH_INFO>& aBranches );
53
55wxString RelativeDate( const wxDateTime& aWhen );
56wxString RelativeDate( const wxDateTime& aWhen, const wxDateTime& aNow );
57
59void UnsplitKeepingSash( wxSplitterWindow* aSplitter, wxWindow* aPane, int& aSashPos );
60
63void KeepDetailWidth( WX_SPLITTER_WINDOW* aSplitter );
64
66void MarkDestructive( wxButton* aButton );
67
69wxString SelectedText( wxListCtrl* aList, int aColumn );
70
72bool ValidateIdentity( const wxString& aName, const wxString& aEmail, wxString& aError );
73
74} // namespace KIGIT
75
76#endif // GIT_UI_UTILS_H
The project's git session.
void SortBranchesForDisplay(std::vector< KIGIT_BRANCH_INFO > &aBranches)
Put the current branch first, then local and remote branches with the newest tips first.
std::unique_lock< std::mutex > WaitForActionLock(KIGIT_COMMON &aCommon, wxWindow *aParent)
TryLockAction that first waits a moment for a status read or fetch to let go.
void UnsplitKeepingSash(wxSplitterWindow *aSplitter, wxWindow *aPane, int &aSashPos)
Close a splitter's second pane, keeping the sash where the user left it for next time.
void ShowBusyMessage(wxWindow *aParent)
Show a busy message for a user action. UI thread only.
std::unique_lock< std::mutex > TryLockAction(KIGIT_COMMON &aCommon, wxWindow *aParent)
Try the action lock and show a busy message if it is unavailable.
bool ValidateIdentity(const wxString &aName, const wxString &aEmail, wxString &aError)
Check a name and email for recording commits. False leaves the reason in aError.
wxString SelectedText(wxListCtrl *aList, int aColumn)
The text of the selected row in a report list, or empty when nothing is selected.
wxString RelativeDate(const wxDateTime &aWhen)
"just now", "3 hours ago", or the ISO date once it is more than a month old.
void KeepDetailWidth(WX_SPLITTER_WINDOW *aSplitter)
Keep a split detail pane at the width its controls need, against both a narrow window and a dragged s...
void MarkDestructive(wxButton *aButton)
Paint a button's text the diff's red, for one that throws something away.