1 #pragma once
2 
3 // clone repo dialog
4 #include "studiox_includes.h"
5 #include "afxwin.h"
6 #include "afxcmn.h"
7 
8 extern "C" {
9 #include "git2.h"
10 }
11 
12 // used for testing, so we don't have to keep deleting the .ini file
13 #ifdef _DEBUG
14 //#define FORCE_CLONE_DIALOG
15 #endif
16 
17 void CloneGUIXRepo(char *local_path, HANDLE write_pipe_handle);
18 
19 class git_progress_screen : public CDialog
20 {
21 public:
22     git_progress_screen(CWnd *parent, CString clone_message);
23     virtual BOOL OnInitDialog();
24 
25     void UpdateGitMessage(const char *str);
26 	void UpdateIndexerProgress(const git_indexer_progress *stats);
27 	void UpdateCheckoutProgress(size_t completed, size_t total);
28 
29 	enum { IDD = IDD_GIT_PROGRESS};
30 
31     // Generated message map functions
32 	DECLARE_MESSAGE_MAP()
33 
34 protected:
35 
36 	CString mCloneMessage;
37 };
38 
39 class clone_repo_dialog : public express_dialog
40 {
41 	DECLARE_DYNAMIC(clone_repo_dialog)
42 public:
43 	clone_repo_dialog(CWnd *parent);
44     virtual BOOL OnInitDialog();
45 
46 // Dialog Data
47 	enum { IDD = IDD_CLONE_REPO };
48 
49 protected:
50 	DECLARE_MESSAGE_MAP()
51 	afx_msg void OnClose();
52 	afx_msg void OnCancel();
53 	afx_msg void OnCloneRepo();
54 	afx_msg void OnSetDirectory();
55 	afx_msg LRESULT OnRepoCloneMsgUpdate(WPARAM wParam, LPARAM lParam);
56 
57 public:
GetReadPipeHandle()58 	HANDLE GetReadPipeHandle() {return mReadPipeHandle;}
59 
60 protected:
61 	void CompleteGUIXRepoClone(CString msg);
62 	void ShowHideChildren(BOOL show);
63 	void PopulateRecentProjects(CString clone_dir);
64 
65 protected:
66 	git_progress_screen *mpProgressScreen;
67 	PROCESS_INFORMATION mProcessInfo;
68 	CString mLocalPath;
69 	HANDLE mWritePipeHandle;
70 	HANDLE mReadPipeHandle;
71 	HANDLE mReadCloneInfoThreadHandle;
72 };
73