File indexing completed on 2025-01-05 05:14:45
0001 #include "pushobserver.h" 0002 0003 namespace Git 0004 { 0005 0006 namespace PushCallbacks 0007 { 0008 0009 int git_helper_packbuilder_progress(int stage, uint32_t current, uint32_t total, void *payload) 0010 { 0011 auto observer = reinterpret_cast<PushObserver *>(payload); 0012 if (!observer) 0013 return 0; 0014 0015 observer->setPackProgressValue(current); 0016 observer->setPackProgressTotal(total); 0017 return 0; 0018 } 0019 0020 int git_helper_push_transfer_progress_cb(unsigned int current, unsigned int total, size_t bytes, void *payload) 0021 { 0022 auto observer = reinterpret_cast<PushObserver *>(payload); 0023 if (!observer) 0024 return 0; 0025 0026 observer->setTransferProgressValue(current); 0027 observer->setTransferProgressTotal(total); 0028 return 0; 0029 } 0030 0031 int git_helper_credential_acquire_cb(git_credential **out, const char *url, const char *username_from_url, unsigned int allowed_types, void *payload) 0032 { 0033 auto observer = reinterpret_cast<PushObserver *>(payload); 0034 if (!observer) 0035 return 0; 0036 0037 return 0; 0038 } 0039 0040 int git_helper_transport_certificate_check_cb(git_cert *cert, int valid, const char *host, void *payload) 0041 { 0042 auto observer = reinterpret_cast<PushObserver *>(payload); 0043 if (!observer) 0044 return 0; 0045 0046 return 0; 0047 } 0048 0049 } 0050 0051 PushObserver::PushObserver(QObject *parent) 0052 { 0053 } 0054 0055 unsigned int PushObserver::packProgressValue() const 0056 { 0057 return mPackProgressValue; 0058 } 0059 0060 void PushObserver::setPackProgressValue(unsigned int packProgressValue) 0061 { 0062 if (mPackProgressValue == packProgressValue) 0063 return; 0064 mPackProgressValue = packProgressValue; 0065 emit packProgressValueChanged(); 0066 } 0067 0068 unsigned int PushObserver::packProgressTotal() const 0069 { 0070 return mPackProgressTotal; 0071 } 0072 0073 void PushObserver::setPackProgressTotal(unsigned int packProgressTotal) 0074 { 0075 if (mPackProgressTotal == packProgressTotal) 0076 return; 0077 mPackProgressTotal = packProgressTotal; 0078 emit packProgressTotalChanged(); 0079 } 0080 0081 unsigned int PushObserver::transferProgressValue() const 0082 { 0083 return mTransferProgressValue; 0084 } 0085 0086 void PushObserver::setTransferProgressValue(unsigned int transferProgressValue) 0087 { 0088 if (mTransferProgressValue == transferProgressValue) 0089 return; 0090 mTransferProgressValue = transferProgressValue; 0091 emit transferProgressValueChanged(); 0092 } 0093 0094 unsigned int PushObserver::transferProgressTotal() const 0095 { 0096 return mTransferProgressTotal; 0097 } 0098 0099 void PushObserver::setTransferProgressTotal(unsigned int transferProgressTotal) 0100 { 0101 if (mTransferProgressTotal == transferProgressTotal) 0102 return; 0103 mTransferProgressTotal = transferProgressTotal; 0104 emit transferProgressTotalChanged(); 0105 } 0106 0107 }