├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── COPYING ├── LICENSE ├── README.md ├── dependency └── tmax │ ├── cups-filters-core-drivers_1.21.6-3_amd64.deb │ ├── cups-filters_1.21.6-3_amd64.deb │ ├── gstreamer1.0-pulseaudio_1.14.4-1_amd64.deb │ ├── libbrotli1_1.0.7-2_amd64.deb │ ├── libcrypto++6_5.6.4-8tmaxos1_i386.deb │ ├── libgstreamer-gl1.0-0_1.14.4-1_amd64.deb │ ├── libhyphen0_2.8.8-7_amd64.deb │ ├── libjavascriptcoregtk-4.0-18_2.22.5-1_amd64.deb │ ├── libwebkit2gtk-4.0-37_2.22.5-1_amd64.deb │ ├── libwoff1_1.0.2-1_amd64.deb │ └── psmisc_23.3-1_amd64.deb ├── img ├── 01_login.png ├── 02_main.png ├── 03_send-01.png ├── 05_send-03.png ├── 06_send-04.png └── 07_recv-01.png └── src ├── .vscode ├── c_cpp_properties.json ├── launch.json ├── settings.json └── tasks.json ├── CMakeLists.txt ├── GCR_CMake ├── LICENSE ├── README.md └── macros │ ├── BuildTargetScript.cmake │ ├── CompileGResources.cmake │ ├── GenerateGXML.cmake │ └── GlibCompileResourcesSupport.cmake └── src ├── CMakeLists.txt ├── assets ├── ADD-ICON-16PX.png ├── APPROVAL-ICON-16PX.png ├── APPROVAL-LIST-ICON-16PX.png ├── ARROW-DOWN-16PX.png ├── ARROW-DOWN.png ├── ARROW-LEFT-ES.png ├── ARROW-LEFT-IS.png ├── ARROW-RIGHT-ES.png ├── ARROW-RIGHT-IS.png ├── ARROW-UP-16PX.png ├── ARROW-UP.png ├── CLOSE-ICON-16PX.png ├── CMakeLists.txt ├── COPY-ICON-16PX.png ├── DETAIL-ICON-16PX.png ├── DOWNLOAD-ICON-ES.png ├── DOWNLOAD-ICON-IS.png ├── LIST-ICON-16PX.png ├── LIST02-ICON-16PX.png ├── LIST03-ICON.png ├── LOGOUT-ICON-16PX.png ├── PASSWORD-ICON-16PX.png ├── REFRESH-ICON-16PX.png ├── SEND-ICON-16PX.png ├── SETTING-ICON-16PX.png ├── SNS-ICON-24PX.png ├── UESER-ICON-ES.png ├── UESER-ICON-IS.png ├── URL-ICON-16PX.png ├── USER-ICON-16PX.png ├── USERCHECK-ICON-16PX.png ├── app-tray-menu.ui ├── es-icon.ico ├── es-icon.png ├── ftc-detail-recv-file-list-row.ui ├── ftc-detail-recv-file-list-sub-page.ui ├── ftc-detail-recv-page.ui ├── ftc-detail-recv-request-info-sub-page.ui ├── ftc-detail-send-history-file-list-row.ui ├── ftc-detail-send-history-file-list-sub-page.ui ├── ftc-detail-send-history-page.ui ├── ftc-detail-send-history-request-info-sub-page.ui ├── ftc-detail-send-page.ui ├── ftc-home-dnd-sub-page.ui ├── ftc-home-header-recv-box.ui ├── ftc-home-header-send-box.ui ├── ftc-home-header-send-history-box.ui ├── ftc-home-page.ui ├── ftc-home-recv-list-row.ui ├── ftc-home-recv-list-sub-page.ui ├── ftc-login-page.ui ├── ftc-main-window.ui ├── is-icon.ico ├── is-icon.png ├── nor-128.png └── style.css ├── core ├── CMakeLists.txt ├── Clipboard.cpp ├── Clipboard.h ├── CommonUtils.cpp ├── CommonUtils.h ├── Event.h ├── EventManager.cpp ├── EventManager.h ├── FileInfo.cpp ├── FileInfo.h ├── FileUtils.cpp ├── FileUtils.h ├── JsonUtils.cpp ├── JsonUtils.h ├── Logger.cpp ├── Logger.h ├── NetUtils.cpp ├── NetUtils.h ├── Request.h ├── Response.cpp ├── Response.h ├── SocketServer.cpp ├── SocketServer.h ├── StringUtils.cpp ├── StringUtils.h ├── TimeUtils.cpp ├── TimeUtils.h ├── UrlRedirection.cpp ├── UrlRedirection.h ├── base64.cpp ├── base64.h ├── bind.c ├── core.cpp ├── core.h ├── http.cpp ├── http.h ├── keybinder.h ├── macro.h ├── model │ ├── ClientConfig.cpp │ ├── ClientConfig.h │ ├── GlobalStruct.cpp │ ├── GlobalStruct.h │ ├── GlobalVar.cpp │ ├── GlobalVar.h │ ├── PackFilePop.h │ ├── Properties.cpp │ ├── Properties.h │ ├── UploadOption.h │ ├── User.cpp │ ├── User.h │ ├── ValueObject.cpp │ └── ValueObject.h ├── sys_utils.cpp ├── sys_utils.h ├── transfer │ ├── Download.h │ ├── DownloadRequest.h │ ├── Upload.h │ └── UploadFile.h ├── urlencode.cpp └── urlencode.h ├── dbus ├── ftcappdbus.h ├── playback.c ├── playback.h └── playback.xml ├── main.cpp ├── request └── libhune_request.a ├── resources.cpp ├── ui ├── CMakeLists.txt ├── Event.h ├── FtcEventCallback.cpp ├── FtcEventCallback.h ├── ftcapplication.cpp ├── ftcapplication.h ├── ftcdetailrecvfilelistrow.cpp ├── ftcdetailrecvfilelistrow.h ├── ftcdetailrecvfilelistsubpage.cpp ├── ftcdetailrecvfilelistsubpage.h ├── ftcdetailrecvpage.cpp ├── ftcdetailrecvpage.h ├── ftcdetailrecvrequestinfosubpage.cpp ├── ftcdetailrecvrequestinfosubpage.h ├── ftcdetailsendhistoryfilelistrow.cpp ├── ftcdetailsendhistoryfilelistrow.h ├── ftcdetailsendhistoryfilelistsubpage.cpp ├── ftcdetailsendhistoryfilelistsubpage.h ├── ftcdetailsendhistorypage.cpp ├── ftcdetailsendhistorypage.h ├── ftcdetailsendhistoryrequestinfosubpage.cpp ├── ftcdetailsendhistoryrequestinfosubpage.h ├── ftcdetailsendpage.cpp ├── ftcdetailsendpage.h ├── ftchomedndsubpage.cpp ├── ftchomedndsubpage.h ├── ftchomeheaderrecvbox.cpp ├── ftchomeheaderrecvbox.h ├── ftchomeheadersendbox.cpp ├── ftchomeheadersendbox.h ├── ftchomeheadersendhistorybox.cpp ├── ftchomeheadersendhistorybox.h ├── ftchomepage.cpp ├── ftchomepage.h ├── ftchomerecvlistrow.cpp ├── ftchomerecvlistrow.h ├── ftchomerecvlistsubpage.cpp ├── ftchomerecvlistsubpage.h ├── ftchomesendhistoryrow.cpp ├── ftchomesendhistoryrow.h ├── ftchomesendhistorysubpage.cpp ├── ftchomesendhistorysubpage.h ├── ftchomesendlistrow.cpp ├── ftchomesendlistrow.h ├── ftchomesendlistsubpage.cpp ├── ftchomesendlistsubpage.h ├── ftcloginpage.cpp ├── ftcloginpage.h ├── ftcmainwindow.cpp ├── ftcmainwindow.h ├── ftcuicommon.cpp └── ftcuicommon.h ├── webkit ├── ftcdbusserver.cpp ├── ftcdbusserver.h ├── ftcwebkit.cpp └── ftcwebkit.h └── webkitextension ├── CMakeLists.txt ├── ftcwebkitextension.cpp └── ftcwebkitextension.h /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # 기여자 행동 강령 규약 2 | 3 | ## 서약 4 | 5 | 개방적이고 친근한 환경 조성을 위해, 기여자와 유지자는 프로젝트와 커뮤니티에서 6 | 연령, 신체 크기, 장애, 민족성, 성 정체성과 표현, 경력, 국적, 외모, 인종, 종교 7 | 또는 성적 정체성과 지향에 관계없이 모두에게 차별없이 참여할 것을 서약합니다. 8 | 9 | ## 표준 10 | 11 | 긍정적인 환경을 조성하기 위해 기여자가 해야 할 행동은 다음과 같습니다: 12 | 13 | * 소외하지 않고 배려하는 언어 사용 14 | * 서로 다른 경험과 관점 존중 15 | * 열린 마음으로 건설적인 비판을 수용 16 | * 커뮤니티에 가장 최선이 무엇인지에 주력 17 | * 다른 커뮤니티 구성원들에 대한 공감 표현 18 | 19 | 하지말아야 할 행동은 다음과 같습니다: 20 | 21 | * 성적인 언어와 이미지 사용, 원치않는 성적 관심이나 접근 22 | * 트롤링, 소모적인 논쟁, 모욕적이거나 비하하는 댓글과 개인적 또는 정치적인 공격 23 | * 공개적이거나 개인적인 괴롭힘 24 | * 명시적인 동의없는 집주소 또는 전자주소 등의 개인 정보의 공개 25 | * 부적절한 것으로 간주될 수 있는 다른 행위 26 | 27 | ## 책임 28 | 29 | 프로젝트 유지자는 허용되는 행동의 기준을 명확히 해야할 책임이 있습니다. 또한, 30 | 하지말아야 할 행동에 대해 적당하고 공정한 시정 조치를 취할 것 입니다. 31 | 32 | 프로젝트 유지자는 이 행동 강령을 따르지 않은 댓글, 커밋, 코드, 위키 편집, 33 | 이슈와 그 외 다른 기여를 삭제, 수정 또는 거부할 권리와 책임이 있습니다. 또한, 34 | 부적당하거나 험악하거나 공격적이거나 해롭다고 생각하는 다른 행동을 한 기여자를 35 | 일시적 또는 영구적으로 퇴장시킬 수 있습니다. 36 | 37 | ## 범위 38 | 39 | 이 행동 강령은 프로젝트 영역에 적용되며, 프로젝트 또는 커뮤니티를 대표할 경우 40 | 공개 영역에도 적용됩니다. 프로젝트 또는 커뮤니티 대표의 예로는 공식 프로젝트 41 | 이메일 주소, 공식 소셜 미디어 계정사용 또는 온/오프라인 이벤트에서 임명된 42 | 대표자의 활동이 있습니다. 프로젝트의 대표는 프로젝트 유지자에 의해 더 정의되고 43 | 명확히 될 것 입니다. 44 | 45 | ## 강제 46 | 47 | 모욕적인, 괴롭힘 또는 기타 하지말아야 할 행동을 발견하면 [메일보내기](mailto:support@hunesion.com)를 48 | 통해 프로젝트 팀에 보고 해 주세요. 모든 불만사항은 검토하고 조사한 뒤 상황에 49 | 따라 필요하고 적절하다고 생각되는 응답을 할 것 입니다. 프로젝트 팀은 사건의 50 | 보고자와 관련한 비밀을 유지할 의무가 있습니다. 구체적인 시행 정책의 자세한 51 | 사항은 별도로 게시할 수 있습니다. 52 | 53 | 행동 강령을 따르지 않거나 강제하지 않은 프로젝트 유지자는 프로젝트 리더의 다른 54 | 구성원의 결정에 따라 일시적 또는 영구적인 제재를 받을 수 있습니다. 55 | 56 | ## 참고 57 | 58 | 이 행동 강령은 http://contributor-covenant.org/version/1/4 에 있는 [Contributor Covenant][homepage] 버전 1.4에서 수정되었습니다 . 59 | 60 | [homepage]: https://www.contributor-covenant.org 61 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## 프로젝트에 기여하는 방법 2 | 우리는 당신의 의견을 사랑합니다! 다음과 같은 경우에 이 프로젝트에 기여할 수 있습니다. 3 | 4 | - 버그보고 5 | - 코드의 현재 상태 논의 6 | - 수정 사항 제출 7 | - 새로운 기능 제안 8 | - 위 각 항목에 대한 샘플소스 또는 링크 제출 9 | 10 | ## 커뮤니티 참여 11 | * 프로젝트 기여를 위한 각종 활동 중에 의사소통이 필요한 경우 12 | 현재 운영하고 있는 커뮤니티는 협력 메신저 툴인 Slack을 이용하여 구성하고 있습니다. 13 | Slack 커뮤니티를 활용하여 소소한 이슈 사항이나 Q&A, 공개SW 커뮤니티 등 개발자와 Contributor의 소통의 공간으로 적극 활용을 권장합니다. 14 | * [Slack 채널 참여 링크](https://join.slack.com/t/huneopenup/shared_invite/zt-g48s3l8x-VYOpTDvoCsQXyqHq0nMlag) 15 | 16 | ## Github으로 개발 17 | 이 프로젝트는 github을 사용하여 코드를 호스팅하고 문제 및 기능 요청을 추적하고 풀 요청을 수락합니다. 18 | 19 | 20 | ## Pull Request 방법 21 | 1. **“fork”** 를 통해 원본 레포지토리를 가져와 내 레포지토리를 만듭니다. 22 | 2. **“clone”** 을 통해 fork한 내 레포지토리를 로컬에 가져옵니다. 23 | 3. 로컬에서 작업 후 “add” -> “commit” -> “push”를 통해 내 레포지토리의 작업내용을 **업로드**합니다. 24 | 4. **“Pull Request”** 를 통해 내 작업내용을 원본 레포지토리에 반영해 달라고 요청합니다. 25 | 26 | 27 | ## Github의 이슈를 사용하여 버그 보고 28 | GitHub 문제를 사용하여 공개 버그를 추적합니다. [이슈](https://github.com/HuneOpenUp/ossFileTransferClient/issues)에서 버그를 보고하시기 바랍니다. 29 | 버그 보고서에는 다음과 같은 내용을 포함하여 주십시오. 30 | 31 | * 간략한 버그 요약 또는 배경설명 32 | * 버그재연 절차 33 | * 되도록 구체적으로 기술해 주십시오. 34 | * 가능하면 샘플코드를 제공해 주십시오. 35 | * 예상했던 결과 36 | * 실제로 일어나는 현상 37 | * 참고사항(버그의 원인 또는 해결에 대한 의견) 38 | 39 | ## 행동강령 40 | 행동강령은 [기여자 행동강령 규약](https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/CODE_OF_CONDUCT.md)을 참고하여 준수해 주시기 바랍니다. 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # *ossFileTransferClient** 3 | 이 프로젝트는 업무망과 인터넷망으로 분리된 망간자료전송 솔루션의 인터넷망용 클라이언트를 개발합니다. 4 | ### 개발대상 개방형OS 5 | * 구름OS 6 | * 티맥스OS 7 | * 하모니카OS 8 | 9 | 망간자료전송 솔루션은 분리된 망(일반적으로 인터넷이 되지 않는 업무망과 인터넷망) 간에 안전하게 파일을 송수신하는 기능을 기본으로 제공하며, 클립보드 연계 및 URL보내기(업무망->인터넷망) 등을 부가적인 편리기능으로 제공합니다. 10 | 기존 망간자료전송 솔루션의 클라이언트 프로그램이 윈도우OS 위주로 지원되고 있어 개방형OS를 도입하기 위해서는 탑재해야 하는 필수 보안프로그램 중 하나인 망간자료전송 클라이언트의 개발과 지원이 꼭 필요합니다. 11 | 12 | # **주요 개발항목** 13 | * UI Resource Template 14 | * Main Application UI 15 | * 파일 보내기 16 | * Drag & Drop 17 | * 파일 받기(UI) 18 | * 파일 받기(자동) 19 | * 다운로드 폴더열기 20 | * 클립보드 수신 21 | * 클립보드 송신 22 | * 클립보드 필터링 23 | * 클립보드 단축키 24 | * 클립보드 파일 Read/Write 25 | * URL 수신 26 | * URL 파일 Read 27 | * 브라우저 실행 28 | * IP/MAC Check 29 | * 메시지 알림 30 | * WebView 31 | * IPC 통신(Main <-> WebView) 32 | 33 | 34 | 35 | *목표기능은 OS와 GTK 라이브러리의 지원여부에 따라 수정 또는 삭제될 수 있습니다.* 36 | 37 | ## **시작하기** 38 | 이 지침에 따라 개발 프로젝트에 참여할 수 있습니다. 39 | 40 | ### **빌드하기** 41 | ossFileTransferClient를 빌드하려면 [WIKI:Build](https://github.com/HuneOpenUp/ossFileTransferClient/wiki/Build)를 참조하십시오. 42 | 43 | ## **전제조건** 44 | 이 프로젝트는 각각의 개방형OS를 공통적으로 지원하기 위해 GTK+ 3.0 기반으로 개발할 예정입니다. 45 | 46 | 기존 솔루션에 개방형OS 클라이언트를 추가하는 것이므로 윈도우용 클라이언트에서 지원하는 기능을 전환하여 개발합니다. 47 | 다만, 기존 윈도우용 클라이언트의 UI 대신에 새로운 UI로 개발하기 위해 신규UI와 이에 따른 설계를 진행하고, 48 | 기본적인 UI가 개발되는 시점부터 이를 기반으로 각각의 기능 모듈 단위로 소스를 공개합니다. 49 | 50 | ## **기여** 51 | [CONTRIBUTION.md](https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/CONTRIBUTING.md) 파일을 읽어 주십시오. 당사의 행동강령과 요청접수 절차에 대한 자세한 내용을 확인하실 수 있습니다. 52 | 53 | 54 | ## **라이선스** 55 | 이 프로젝트는 LGPL 2.1로 라이선스가 부여되었습니다. 자세한 내용은 [LICENSE](https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/LICENSE) 파일을 참조하십시오. 56 | -------------------------------------------------------------------------------- /dependency/tmax/cups-filters-core-drivers_1.21.6-3_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/cups-filters-core-drivers_1.21.6-3_amd64.deb -------------------------------------------------------------------------------- /dependency/tmax/cups-filters_1.21.6-3_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/cups-filters_1.21.6-3_amd64.deb -------------------------------------------------------------------------------- /dependency/tmax/gstreamer1.0-pulseaudio_1.14.4-1_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/gstreamer1.0-pulseaudio_1.14.4-1_amd64.deb -------------------------------------------------------------------------------- /dependency/tmax/libbrotli1_1.0.7-2_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/libbrotli1_1.0.7-2_amd64.deb -------------------------------------------------------------------------------- /dependency/tmax/libcrypto++6_5.6.4-8tmaxos1_i386.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/libcrypto++6_5.6.4-8tmaxos1_i386.deb -------------------------------------------------------------------------------- /dependency/tmax/libgstreamer-gl1.0-0_1.14.4-1_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/libgstreamer-gl1.0-0_1.14.4-1_amd64.deb -------------------------------------------------------------------------------- /dependency/tmax/libhyphen0_2.8.8-7_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/libhyphen0_2.8.8-7_amd64.deb -------------------------------------------------------------------------------- /dependency/tmax/libjavascriptcoregtk-4.0-18_2.22.5-1_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/libjavascriptcoregtk-4.0-18_2.22.5-1_amd64.deb -------------------------------------------------------------------------------- /dependency/tmax/libwebkit2gtk-4.0-37_2.22.5-1_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/libwebkit2gtk-4.0-37_2.22.5-1_amd64.deb -------------------------------------------------------------------------------- /dependency/tmax/libwoff1_1.0.2-1_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/libwoff1_1.0.2-1_amd64.deb -------------------------------------------------------------------------------- /dependency/tmax/psmisc_23.3-1_amd64.deb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/dependency/tmax/psmisc_23.3-1_amd64.deb -------------------------------------------------------------------------------- /img/01_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/img/01_login.png -------------------------------------------------------------------------------- /img/02_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/img/02_main.png -------------------------------------------------------------------------------- /img/03_send-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/img/03_send-01.png -------------------------------------------------------------------------------- /img/05_send-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/img/05_send-03.png -------------------------------------------------------------------------------- /img/06_send-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/img/06_send-04.png -------------------------------------------------------------------------------- /img/07_recv-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/img/07_recv-01.png -------------------------------------------------------------------------------- /src/.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Linux", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "${workspaceFolder}/src/**", 8 | "${workspaceFolder}/src/core/**", 9 | "${workspaceFolder}/src/core/model/**", 10 | "/usr/include", 11 | "/usr/include/gtk-3.0", 12 | "/usr/include/at-spi2-atk/2.0", 13 | "/usr/include/at-spi-2.0", 14 | "/usr/include/dbus-1.0", 15 | "/usr/lib/x86_64-linux-gnu/dbus-1.0/include", 16 | "/usr/include/gtk-3.0", 17 | "/usr/include/gio-unix-2.0/", 18 | "/usr/include/cairo", 19 | "/usr/include/pango-1.0", 20 | "/usr/include/harfbuzz", 21 | "/usr/include/pango-1.0", 22 | "/usr/include/atk-1.0", 23 | "/usr/include/cairo", 24 | "/usr/include/pixman-1", 25 | "/usr/include/freetype2", 26 | "/usr/include/libpng16", 27 | "/usr/include/freetype2", 28 | "/usr/include/libpng16", 29 | "/usr/include/gdk-pixbuf-2.0", 30 | "/usr/include/libpng16", 31 | "/usr/include/glib-2.0", 32 | "/usr/lib/x86_64-linux-gnu/glib-2.0/include", 33 | "/usr/include/json-glib-1.0", 34 | "/usr/include/libsoup-2.4", 35 | "/usr/include/webkitgtk-4.0" 36 | ], 37 | "defines": [], 38 | "compilerPath": "/usr/bin/gcc", 39 | "cStandard": "c11", 40 | "cppStandard": "c++17", 41 | "intelliSenseMode": "clang-x64", 42 | "compileCommands": "${workspaceFolder}/build/compile_commands.json", 43 | "configurationProvider": "go2sh.cmake-integration" 44 | } 45 | ], 46 | "version": 4 47 | } -------------------------------------------------------------------------------- /src/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "(gdb) Launch", 9 | "type": "cppdbg", 10 | "request": "launch", 11 | "program": "${workspaceFolder}/build/bin/ftc", 12 | "args": [], 13 | "stopAtEntry": false, 14 | "cwd": "${workspaceFolder}/build/bin", 15 | "environment": [{ 16 | "name":"DISPLAY", 17 | "value":":0" 18 | }], 19 | "externalConsole": false, 20 | "MIMode": "gdb", 21 | "setupCommands": [ 22 | { 23 | "description": "Enable pretty-printing for gdb", 24 | "text": "-enable-pretty-printing", 25 | "ignoreFailures": true 26 | } 27 | ] 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /src/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "webkit2.h": "c", 4 | "webkitcookiemanager.h": "c", 5 | "gtk.h": "c", 6 | "viewer_file.h": "c", 7 | "crypt.h": "c", 8 | "evp.h": "c", 9 | "crypto.h": "c", 10 | "base64.h": "c", 11 | "soup.h": "c", 12 | "soup-address.h": "c", 13 | "soup-types.h": "c", 14 | "soup-version.h": "c", 15 | "glib.h": "c", 16 | "gio.h": "c", 17 | "giotypes.h": "c", 18 | "gioenums.h": "c", 19 | "glib-object.h": "c", 20 | "gboxed.h": "c", 21 | "gbinding.h": "c", 22 | "galloca.h": "c", 23 | "gtypes.h": "c", 24 | "glibconfig.h": "c", 25 | "globalvar.h": "c", 26 | "array": "cpp", 27 | "atomic": "cpp", 28 | "*.tcc": "cpp", 29 | "cctype": "cpp", 30 | "clocale": "cpp", 31 | "cmath": "cpp", 32 | "cstdarg": "cpp", 33 | "cstddef": "cpp", 34 | "cstdint": "cpp", 35 | "cstdio": "cpp", 36 | "cstdlib": "cpp", 37 | "cstring": "cpp", 38 | "cwchar": "cpp", 39 | "cwctype": "cpp", 40 | "deque": "cpp", 41 | "unordered_map": "cpp", 42 | "vector": "cpp", 43 | "exception": "cpp", 44 | "algorithm": "cpp", 45 | "memory": "cpp", 46 | "memory_resource": "cpp", 47 | "optional": "cpp", 48 | "string": "cpp", 49 | "string_view": "cpp", 50 | "system_error": "cpp", 51 | "tuple": "cpp", 52 | "type_traits": "cpp", 53 | "utility": "cpp", 54 | "fstream": "cpp", 55 | "initializer_list": "cpp", 56 | "iosfwd": "cpp", 57 | "istream": "cpp", 58 | "limits": "cpp", 59 | "new": "cpp", 60 | "ostream": "cpp", 61 | "sstream": "cpp", 62 | "stdexcept": "cpp", 63 | "streambuf": "cpp", 64 | "cinttypes": "cpp", 65 | "typeinfo": "cpp", 66 | "ctime": "cpp", 67 | "iomanip": "cpp", 68 | "iostream": "cpp", 69 | "functional": "cpp", 70 | "iterator": "cpp", 71 | "list": "cpp", 72 | "map": "cpp", 73 | "chrono": "cpp", 74 | "condition_variable": "cpp", 75 | "ratio": "cpp", 76 | "mutex": "cpp", 77 | "thread": "cpp", 78 | "cassert": "cpp", 79 | "cerrno": "cpp", 80 | "cfloat": "cpp", 81 | "climits": "cpp", 82 | "ios": "cpp", 83 | "locale": "cpp", 84 | "queue": "cpp", 85 | "cstdbool": "cpp", 86 | "random": "cpp", 87 | "set": "cpp", 88 | "sha.h": "c", 89 | "xkblib.h": "c", 90 | "clientconfig.h": "c" 91 | }, 92 | "python.pythonPath": "/usr/bin/python2.7" 93 | } -------------------------------------------------------------------------------- /src/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "command": "sh", 6 | "isShellCommand": true, 7 | "args": ["-c"], 8 | "showOutput": "always", 9 | "options": { 10 | "cwd": "${workspaceRoot}" 11 | }, 12 | "tasks": [ 13 | { 14 | "taskName": "cmake", 15 | "args": [ 16 | "rm -rf ./build; mkdir ./build; cd ./build; cmake -DCMAKE_BUILD_TYPE=Debug .." 17 | ], 18 | "problemMatcher": [ 19 | "$gcc" 20 | ] 21 | }, 22 | { 23 | "taskName": "cmake_release", 24 | "args": [ 25 | "rm -rf ./build; mkdir ./build; cd ./build; cmake .." 26 | ], 27 | "problemMatcher": [ 28 | "$gcc" 29 | ] 30 | }, 31 | { 32 | "taskName": "make", 33 | "args": [ 34 | "cd ./build; make -j 4" 35 | ], 36 | "isBuildCommand": true, 37 | "problemMatcher": [] 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.8) 2 | 3 | project ("FTC") 4 | 5 | 6 | 7 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/GCR_CMake/macros) 8 | include (GlibCompileResourcesSupport) 9 | 10 | FIND_PACKAGE(PkgConfig REQUIRED) 11 | PKG_CHECK_MODULES(GTK3 REQUIRED gtk+-3.0) 12 | PKG_CHECK_MODULES(WEBKIT REQUIRED webkit2gtk-4.0) 13 | PKG_CHECK_MODULES(WEBKIT_EXT REQUIRED webkit2gtk-web-extension-4.0) 14 | PKG_CHECK_MODULES(UUID REQUIRED uuid) 15 | FIND_PACKAGE(OpenSSL REQUIRED) 16 | FIND_PACKAGE(X11 REQUIRED) 17 | 18 | INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS} ${WEBKIT_INCLUDE_DIRS} ${WEBKIT_EXT_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS} ${X11_INCLUDE_DIRS} /usr/include/libsoup-2.4 /usr/include/json-glib-1.0) 19 | LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS} ${WEBKIT_LIBRARY_DIRS} ${WEBKIT_EXT_LIBRARY_DIRS} ${OPENSSL_LIBRARY_DIRS} ${X11_LIBRARY_DIRS} ${CMAKE_SOURCE_DIR}/src/request/ ${CMAKE_SOURCE_DIR}/build/lib) 20 | ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER} ${WEBKIT_CFLAGS_OTHER} ${WEBKIT_EXT_CFLAGS_OTHER} ${OPENSSL_CFLAGS_OTHER} ${X11_CFLAGS_OTHER}) 21 | 22 | set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/build/bin") 23 | set(LIBRARY_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/build/lib/ftc/") 24 | 25 | add_subdirectory ("src") -------------------------------------------------------------------------------- /src/GCR_CMake/macros/BuildTargetScript.cmake: -------------------------------------------------------------------------------- 1 | # This file is used to be invoked at build time. It generates the needed 2 | # resource XML file. 3 | 4 | # Input variables that need to provided when invoking this script: 5 | # GXML_OUTPUT The output file path where to save the XML file. 6 | # GXML_COMPRESS_ALL Sets all COMPRESS flags in all resources in resource 7 | # list. 8 | # GXML_NO_COMPRESS_ALL Removes all COMPRESS flags in all resources in 9 | # resource list. 10 | # GXML_STRIPBLANKS_ALL Sets all STRIPBLANKS flags in all resources in 11 | # resource list. 12 | # GXML_NO_STRIPBLANKS_ALL Removes all STRIPBLANKS flags in all resources in 13 | # resource list. 14 | # GXML_TOPIXDATA_ALL Sets all TOPIXDATA flags i nall resources in resource 15 | # list. 16 | # GXML_NO_TOPIXDATA_ALL Removes all TOPIXDATA flags in all resources in 17 | # resource list. 18 | # GXML_PREFIX Overrides the resource prefix that is prepended to 19 | # each relative name in registered resources. 20 | # GXML_RESOURCES The list of resource files. Whether absolute or 21 | # relative path is equal. 22 | 23 | # Include the GENERATE_GXML() function. 24 | include(${CMAKE_CURRENT_LIST_DIR}/GenerateGXML.cmake) 25 | 26 | # Set flags to actual invocation flags. 27 | if(GXML_COMPRESS_ALL) 28 | set(GXML_COMPRESS_ALL COMPRESS_ALL) 29 | endif() 30 | if(GXML_NO_COMPRESS_ALL) 31 | set(GXML_NO_COMPRESS_ALL NO_COMPRESS_ALL) 32 | endif() 33 | if(GXML_STRIPBLANKS_ALL) 34 | set(GXML_STRIPBLANKS_ALL STRIPBLANKS_ALL) 35 | endif() 36 | if(GXML_NO_STRIPBLANKS_ALL) 37 | set(GXML_NO_STRIPBLANKS_ALL NO_STRIPBLANKS_ALL) 38 | endif() 39 | if(GXML_TOPIXDATA_ALL) 40 | set(GXML_TOPIXDATA_ALL TOPIXDATA_ALL) 41 | endif() 42 | if(GXML_NO_TOPIXDATA_ALL) 43 | set(GXML_NO_TOPIXDATA_ALL NO_TOPIXDATA_ALL) 44 | endif() 45 | 46 | # Replace " " with ";" to import the list over the command line. Otherwise 47 | # CMake would interprete the passed resources as a whole string. 48 | string(REPLACE " " ";" GXML_RESOURCES ${GXML_RESOURCES}) 49 | 50 | # Invoke the gresource XML generation function. 51 | generate_gxml(${GXML_OUTPUT} 52 | ${GXML_COMPRESS_ALL} ${GXML_NO_COMPRESS_ALL} 53 | ${GXML_STRIPBLANKS_ALL} ${GXML_NO_STRIPBLANKS_ALL} 54 | ${GXML_TOPIXDATA_ALL} ${GXML_NO_TOPIXDATA_ALL} 55 | PREFIX ${GXML_PREFIX} 56 | RESOURCES ${GXML_RESOURCES}) 57 | 58 | -------------------------------------------------------------------------------- /src/GCR_CMake/macros/GlibCompileResourcesSupport.cmake: -------------------------------------------------------------------------------- 1 | # Path to this file. 2 | set(GCR_CMAKE_MACRO_DIR ${CMAKE_CURRENT_LIST_DIR}) 3 | 4 | # Finds the glib-compile-resources executable. 5 | find_program(GLIB_COMPILE_RESOURCES_EXECUTABLE glib-compile-resources) 6 | mark_as_advanced(GLIB_COMPILE_RESOURCES_EXECUTABLE) 7 | 8 | # Include the cmake files containing the functions. 9 | include(${GCR_CMAKE_MACRO_DIR}/CompileGResources.cmake) 10 | include(${GCR_CMAKE_MACRO_DIR}/GenerateGXML.cmake) 11 | 12 | -------------------------------------------------------------------------------- /src/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | cmake_minimum_required (VERSION 3.8) 3 | add_subdirectory ("core") 4 | add_subdirectory("assets") 5 | add_subdirectory ("ui") 6 | add_subdirectory("webkitextension") 7 | add_executable (ftc main.cpp resources.cpp) 8 | TARGET_LINK_LIBRARIES(ftc ${GTK3_LIBRARIES} ${WEBKIT_LIBRARIES} ${OPENSSL_LIBRARIES} ${UUID_LIBRARIES} hune_core hune_ui json-glib-1.0 pthread) -------------------------------------------------------------------------------- /src/src/assets/ADD-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/ADD-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/APPROVAL-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/APPROVAL-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/APPROVAL-LIST-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/APPROVAL-LIST-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/ARROW-DOWN-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/ARROW-DOWN-16PX.png -------------------------------------------------------------------------------- /src/src/assets/ARROW-DOWN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/ARROW-DOWN.png -------------------------------------------------------------------------------- /src/src/assets/ARROW-LEFT-ES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/ARROW-LEFT-ES.png -------------------------------------------------------------------------------- /src/src/assets/ARROW-LEFT-IS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/ARROW-LEFT-IS.png -------------------------------------------------------------------------------- /src/src/assets/ARROW-RIGHT-ES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/ARROW-RIGHT-ES.png -------------------------------------------------------------------------------- /src/src/assets/ARROW-RIGHT-IS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/ARROW-RIGHT-IS.png -------------------------------------------------------------------------------- /src/src/assets/ARROW-UP-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/ARROW-UP-16PX.png -------------------------------------------------------------------------------- /src/src/assets/ARROW-UP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/ARROW-UP.png -------------------------------------------------------------------------------- /src/src/assets/CLOSE-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/CLOSE-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.8) 2 | 3 | set(RESOURCE_LIST 4 | app-tray-menu.ui 5 | ftc-main-window.ui 6 | ftc-login-page.ui 7 | ftc-home-page.ui 8 | ftc-home-dnd-sub-page.ui 9 | ftc-home-header-recv-box.ui 10 | ftc-home-header-send-box.ui 11 | ftc-home-header-send-history-box.ui 12 | ftc-home-recv-list-row.ui 13 | ftc-home-recv-list-sub-page.ui 14 | ftc-detail-recv-page.ui 15 | ftc-detail-recv-file-list-sub-page.ui 16 | ftc-detail-recv-file-list-row.ui 17 | ftc-detail-recv-request-info-sub-page.ui 18 | ftc-detail-send-page.ui 19 | ftc-detail-send-history-request-info-sub-page.ui 20 | ftc-detail-send-history-page.ui 21 | ftc-detail-send-history-file-list-sub-page.ui 22 | ftc-detail-send-history-file-list-row.ui 23 | style.css 24 | ADD-ICON-16PX.png 25 | APPROVAL-ICON-16PX.png 26 | APPROVAL-LIST-ICON-16PX.png 27 | ARROW-DOWN-16PX.png 28 | ARROW-DOWN.png 29 | ARROW-LEFT-ES.png 30 | ARROW-LEFT-IS.png 31 | ARROW-RIGHT-ES.png 32 | ARROW-RIGHT-IS.png 33 | ARROW-UP-16PX.png 34 | ARROW-UP.png 35 | CLOSE-ICON-16PX.png 36 | COPY-ICON-16PX.png 37 | DETAIL-ICON-16PX.png 38 | DOWNLOAD-ICON-ES.png 39 | DOWNLOAD-ICON-IS.png 40 | LIST-ICON-16PX.png 41 | LIST02-ICON-16PX.png 42 | LIST03-ICON.png 43 | LOGOUT-ICON-16PX.png 44 | PASSWORD-ICON-16PX.png 45 | REFRESH-ICON-16PX.png 46 | SEND-ICON-16PX.png 47 | SETTING-ICON-16PX.png 48 | UESER-ICON-ES.png 49 | UESER-ICON-IS.png 50 | URL-ICON-16PX.png 51 | USERCHECK-ICON-16PX.png 52 | USER-ICON-16PX.png 53 | nor-128.png 54 | SNS-ICON-24PX.png 55 | ) 56 | 57 | compile_gresources(RESOURCE_LIST 58 | XML_OUT 59 | TYPE EMBED_C 60 | PREFIX /com/hunesion/ftcapp/ 61 | COMPRESS_ALL 62 | RESOURCES ${RESOURCE_LIST}) 63 | 64 | add_custom_target(resource ALL DEPENDS ${RESOURCE_LIST}) 65 | 66 | get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY) 67 | message(${PARENT_DIR}) 68 | add_custom_command(TARGET resource 69 | POST_BUILD 70 | COMMAND ${CMAKE_COMMAND} -E copy 71 | ${CMAKE_CURRENT_BINARY_DIR}/resources.c 72 | ${PARENT_DIR}/resources.cpp 73 | ) 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/src/assets/COPY-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/COPY-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/DETAIL-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/DETAIL-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/DOWNLOAD-ICON-ES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/DOWNLOAD-ICON-ES.png -------------------------------------------------------------------------------- /src/src/assets/DOWNLOAD-ICON-IS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/DOWNLOAD-ICON-IS.png -------------------------------------------------------------------------------- /src/src/assets/LIST-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/LIST-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/LIST02-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/LIST02-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/LIST03-ICON.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/LIST03-ICON.png -------------------------------------------------------------------------------- /src/src/assets/LOGOUT-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/LOGOUT-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/PASSWORD-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/PASSWORD-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/REFRESH-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/REFRESH-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/SEND-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/SEND-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/SETTING-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/SETTING-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/SNS-ICON-24PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/SNS-ICON-24PX.png -------------------------------------------------------------------------------- /src/src/assets/UESER-ICON-ES.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/UESER-ICON-ES.png -------------------------------------------------------------------------------- /src/src/assets/UESER-ICON-IS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/UESER-ICON-IS.png -------------------------------------------------------------------------------- /src/src/assets/URL-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/URL-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/USER-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/USER-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/USERCHECK-ICON-16PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/USERCHECK-ICON-16PX.png -------------------------------------------------------------------------------- /src/src/assets/app-tray-menu.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | _열기 8 | app.open 9 | 10 | 11 | _열기2 12 | app.open 13 | 14 |
15 |
16 | 17 | _종료 18 | app.quit 19 | 20 |
21 |
22 |
23 | -------------------------------------------------------------------------------- /src/src/assets/es-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/es-icon.ico -------------------------------------------------------------------------------- /src/src/assets/es-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/es-icon.png -------------------------------------------------------------------------------- /src/src/assets/ftc-detail-recv-file-list-row.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 127 | 128 | -------------------------------------------------------------------------------- /src/src/assets/ftc-home-header-recv-box.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 83 | 84 | -------------------------------------------------------------------------------- /src/src/assets/ftc-home-header-send-box.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 86 | 87 | -------------------------------------------------------------------------------- /src/src/assets/ftc-home-header-send-history-box.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 83 | 84 | -------------------------------------------------------------------------------- /src/src/assets/ftc-home-recv-list-row.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 115 | 116 | -------------------------------------------------------------------------------- /src/src/assets/ftc-home-recv-list-sub-page.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 31 | 32 | -------------------------------------------------------------------------------- /src/src/assets/ftc-main-window.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 32 | 33 | -------------------------------------------------------------------------------- /src/src/assets/is-icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/is-icon.ico -------------------------------------------------------------------------------- /src/src/assets/is-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/is-icon.png -------------------------------------------------------------------------------- /src/src/assets/nor-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/assets/nor-128.png -------------------------------------------------------------------------------- /src/src/core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.8) 2 | 3 | add_library(hune_core 4 | core.cpp 5 | base64.cpp 6 | StringUtils.cpp 7 | TimeUtils.cpp 8 | EventManager.cpp 9 | urlencode.cpp 10 | JsonUtils.cpp 11 | FileInfo.cpp 12 | http.cpp 13 | Response.cpp 14 | Logger.cpp 15 | FileUtils.cpp 16 | NetUtils.cpp 17 | sys_utils.cpp 18 | SocketServer.cpp 19 | bind.c 20 | CommonUtils.cpp 21 | UrlRedirection.cpp 22 | Clipboard.cpp 23 | model/ValueObject.cpp 24 | model/ClientConfig.cpp 25 | model/GlobalVar.cpp 26 | model/User.cpp 27 | model/Properties.cpp 28 | model/GlobalStruct.cpp 29 | ) 30 | 31 | IF (CMAKE_BUILD_TYPE MATCHES Debug) 32 | TARGET_COMPILE_DEFINITIONS( hune_core PUBLIC -DFTC_DEBUG=1 ) 33 | ENDIF() 34 | 35 | TARGET_LINK_LIBRARIES(hune_core hune_request ${GTK3_LIBRARIES} ${WEBKIT_LIBRARIES} ${OPENSSL_LIBRARIES} ${X11_LIBRARIES} -luuid -lpthread json-glib-1.0) 36 | 37 | -------------------------------------------------------------------------------- /src/src/core/Clipboard.h: -------------------------------------------------------------------------------- 1 | #ifndef __FTC_CORE_CLIPBOARD_H__ 2 | #define __FTC_CORE_CLIPBOARD_H__ 3 | #include 4 | #include 5 | #include "macro.h" 6 | #include "EventManager.h" 7 | #include "Event.h" 8 | #include "model/ValueObject.h" 9 | 10 | BEGIN_FTC_CORE 11 | 12 | typedef struct _ClipboardFormat 13 | { 14 | int length; 15 | char *data; 16 | 17 | _ClipboardFormat() 18 | { 19 | length = 0; 20 | data = nullptr; 21 | } 22 | } ClipboardFormat; 23 | 24 | class Clipboard{ 25 | public: 26 | static Clipboard *getInstance(); 27 | static void destroyInstance(); 28 | virtual ~Clipboard(); 29 | 30 | enum FORMAT { 31 | DONE, 32 | IMAGE, 33 | RICH_TEXT, 34 | TEXT, 35 | CSHARP_TEXT 36 | }; 37 | 38 | public: 39 | FORMAT getFormat(); 40 | FORMAT get(char **buffer, unsigned int *len); 41 | bool send(const char *to_network); 42 | bool set(std::map &dataFormat); 43 | bool set(FORMAT format, char *buffer, unsigned int len); 44 | bool loadFile(const char *filepath); 45 | 46 | void setMainWindow(GtkWidget *widget); 47 | private: 48 | Clipboard(); 49 | void dispose(); 50 | 51 | static void sendThread(char *toNetwrokIp, char *sendData, unsigned int dataLen); 52 | 53 | bool setImageData(const char *buffer, unsigned int len); 54 | bool setRichTextData(const char *buffer, unsigned int len); 55 | bool setTextData(const char *buffer, unsigned int len); 56 | 57 | static void setImageDataEvent(Event *evt); 58 | static void setRichTextDataEvent(Event *evt); 59 | static void setTextDataEvent(Event *evt); 60 | 61 | bool getImageData(char **buffer, unsigned int *len); 62 | bool getRichTextData(char **buffer, unsigned int *len); 63 | bool getTextData(char **buffer, unsigned int *len); 64 | 65 | ClipboardFormat readFormatData(GInputStream *istream); 66 | bool checkAllowFormat(FORMAT format); 67 | private: 68 | static Clipboard *s_instance ; 69 | GtkWidget *_main_window ; 70 | 71 | }; 72 | 73 | END_FTC_CORE 74 | 75 | #endif -------------------------------------------------------------------------------- /src/src/core/CommonUtils.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "CommonUtils.h" 3 | 4 | BEGIN_FTC_CORE 5 | namespace CommonUtils 6 | { 7 | void callMessageBoxEvent(const std::string &message) 8 | { 9 | std::string *param = NULL; 10 | EventManager *event_mgr = NULL; 11 | event_mgr = EventManager::getInstance(); 12 | if (event_mgr == nullptr) { 13 | return; 14 | } 15 | 16 | param = new std::string(message); 17 | event_mgr->dispatchEventAsync(FTC_CORE_MESSAGE_BOX, (void*)param, [](void *release){ 18 | if (release != nullptr) { 19 | delete (std::string*)release; 20 | release = nullptr; 21 | } 22 | }); 23 | 24 | return; 25 | } 26 | 27 | void callNotificationEvent(const std::string &message) 28 | { 29 | std::string *param = NULL; 30 | EventManager *event_mgr = NULL; 31 | event_mgr = EventManager::getInstance(); 32 | if (event_mgr == nullptr) { 33 | return; 34 | } 35 | 36 | param = new std::string(message); 37 | event_mgr->dispatchEventAsync(FTC_CORE_DESKTOP_NOTIFICATION, (void*)param, [](void *release){ 38 | if (release != nullptr) { 39 | delete (std::string*)release; 40 | release = nullptr; 41 | } 42 | }); 43 | 44 | return; 45 | } 46 | 47 | std::string getRandomString(int length) 48 | { 49 | static const char alphanum[] = "0123456789" 50 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 51 | "abcdefghijklmnopqrstuvwxyz"; 52 | char *random = NULL; 53 | std::string rv; 54 | 55 | random = new char[length + 1]; 56 | memset(random, 0, length + 1); 57 | 58 | unsigned int seed = time(0); 59 | 60 | for (int i = 0; i < length; ++i) { 61 | random[i] = alphanum[rand_r(&seed) % (sizeof(alphanum) - 1)]; 62 | } 63 | 64 | rv = random; 65 | 66 | if (random) { 67 | delete[] random; 68 | random = NULL; 69 | } 70 | 71 | return rv; 72 | } 73 | } 74 | END_FTC_CORE -------------------------------------------------------------------------------- /src/src/core/CommonUtils.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_COMMON_UTILS_H_ 2 | #define _FTC_COMMON_UTILS_H_ 3 | 4 | #include 5 | #include "core.h" 6 | 7 | BEGIN_FTC_CORE 8 | namespace CommonUtils 9 | { 10 | void callMessageBoxEvent(const std::string &message); 11 | 12 | void callNotificationEvent(const std::string &message); 13 | 14 | std::string getRandomString(int length); 15 | } 16 | END_FTC_CORE 17 | 18 | #endif /* _FTC_COMMON_UTILS_H_ */ -------------------------------------------------------------------------------- /src/src/core/Event.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | 13 | #ifndef _FTC_CORE_EVENT_H_ 14 | #define _FTC_CORE_EVENT_H_ 15 | 16 | #define FTC_CORE_LOGIN_EVENT "Ftc::Core::Login" 17 | #define FTC_CORE_LOGIN_LOCATION_EVENT "Ftc::Core::LoginLocation" 18 | #define FTC_CORE_RECV_LIST_REFRESH "Ftc::Core::RecvListRefresh" 19 | #define FTC_CORE_DOWNLOAD_RECV_RESULT_EVENT "Ftc::Core::DownloadRecvResult" 20 | #define FTC_CORE_DOWNLOAD_HISTORY_RESULT_EVENT "Ftc::Core::DownloadHistoryResult" 21 | #define FTC_CORE_UPLOAD_RESULT_EVENT "Ftc::Core::UploadResult" 22 | #define FTC_CORE_CLIPBOARD_SET_TEXT "Ftc::Core::ClipboardSetText" 23 | #define FTC_CORE_CLIPBOARD_SET_IMAGE "Ftc::Core::ClipboardSetImage" 24 | #define FTC_CORE_CLIPBOARD_SET_RICHTEXT "Ftc::Core::ClipboardSetRichText" 25 | #define FTC_CORE_DESKTOP_NOTIFICATION "Ftc::Core::DesktopNotification" 26 | #define FTC_CORE_MESSAGE_BOX "Ftc::Core::MessageBox" 27 | 28 | #endif /* _FTC_CORE_EVENT_H_ */ 29 | -------------------------------------------------------------------------------- /src/src/core/EventManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | 13 | #ifndef _FTC_CORE_EVENT_MANAGER_H_ 14 | #define _FTC_CORE_EVENT_MANAGER_H_ 15 | #include 16 | #include 17 | #include 18 | #include "macro.h" 19 | 20 | 21 | BEGIN_FTC_CORE 22 | 23 | class Event ; 24 | class EventListener ; 25 | class EventManager; 26 | 27 | typedef const std::function EVENT_CALLBACK; 28 | 29 | class Event { 30 | public: 31 | static Event *create(const char *eventName, void* _userData = nullptr); 32 | static Event *create(const std::string &eventName , void* _userData = nullptr); 33 | virtual ~Event(); 34 | const std::string &getName(){ return _name; } 35 | void *getUserData() {return _userData; } 36 | int incRefCount(){ 37 | ++(this->_refCount); 38 | return this->_refCount; 39 | } 40 | void decRefCount(){ 41 | --(this->_refCount); 42 | if (this->_refCount <= 0) delete this; 43 | } 44 | 45 | 46 | 47 | private: 48 | Event(const std::string &eventName, void *userData); 49 | 50 | 51 | std::string _name ; 52 | void *_userData ; 53 | int _refCount ; 54 | 55 | }; 56 | 57 | class EventListener{ 58 | public : 59 | static EventListener *create(void *target , const char *eventName , const EVENT_CALLBACK &callback); 60 | static EventListener *create(void *target, const std::string &eventName , const EVENT_CALLBACK &callback); 61 | virtual ~EventListener(); 62 | const std::string &getEventName(){return this->_eventName; } 63 | void *getTarget(){return this->_target; } 64 | const EVENT_CALLBACK &getCallback(){return this->_callback;} 65 | int getRefCount(){ return this->_refCount ; } 66 | int incRefCount(){ ++(this->_refCount); return this->_refCount ; } 67 | void decRefCount(){ 68 | --(this->_refCount) ; 69 | if (this->_refCount <= 0) delete this ; 70 | } 71 | 72 | private : 73 | EventListener(void *target , const std::string &eventName , const EVENT_CALLBACK &callback); 74 | 75 | std::string _eventName ; 76 | void* _target ; 77 | std::function _callback ; 78 | int _refCount ; 79 | }; 80 | 81 | 82 | class EventManager{ 83 | public: 84 | static EventManager *getInstance(); 85 | static void destroyInstance(); 86 | bool addEventListener(void *target , const char *eventName , const EVENT_CALLBACK &callback); 87 | bool dispatchEvent(const char *eventName , void *userData = nullptr ) ; 88 | bool dispatchEventAsync(const char *eventName, void *userData = nullptr , void (*release)(void*) = nullptr); 89 | void setAsyncEventCallback(bool (*asynchEventCallback)(const char *eventName , void *userData , void (*release)(void*))); 90 | bool removeEventListener(void *target, const char *eventName = nullptr); 91 | void dispose(); 92 | 93 | protected: 94 | EventManager(); 95 | ~EventManager(); 96 | bool hasEventListener(void *target, const char *eventName); 97 | bool addEventListenerToEventMap(EventListener *listener); 98 | bool addEventListenerToTargetMap(EventListener *listener); 99 | bool removeEventListenerFromEventMap(EventListener *listener) ; 100 | bool removeEventListenerFromEventMap(const char *eventName, void *target); 101 | bool removeEventListenerFromTargetMap(void *target, const char *eventName); 102 | 103 | 104 | private: 105 | static EventManager *s_Instance ; 106 | std::map> _eventMap ; 107 | std::map> _targetMap ; 108 | bool (*_asyncEventCallback)(const char *eventName , void *userData , void (*release)(void*)); 109 | }; 110 | END_FTC_CORE 111 | #endif /* _FTC_CORE_EVENT_MANAGER_H_ */ -------------------------------------------------------------------------------- /src/src/core/FileInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include 13 | 14 | #include "FileInfo.h" 15 | #include "StringUtils.h" 16 | 17 | 18 | #define PATH_SEPERATOR '/' 19 | 20 | 21 | BEGIN_FTC_CORE 22 | 23 | FileInfo::FileInfo():_exist(false){ 24 | 25 | } 26 | 27 | FileInfo::FileInfo(const char *path) : 28 | _exist(false){ 29 | int rv = 0 ; 30 | size_t site = 0 ; 31 | const char *tmp = nullptr ; 32 | memset(&(this->_stat), 0 , sizeof(struct stat)); 33 | if (path == nullptr) return ; 34 | this->_fullPath = path ; 35 | if (this->_fullPath.empty()) return ; 36 | 37 | site = this->_fullPath.size() - 1; 38 | if (this->_fullPath.size() > 1 && this->_fullPath.at(site) == PATH_SEPERATOR){ 39 | StringUtils::rtrim(this->_fullPath, PATH_SEPERATOR); 40 | 41 | // if _fullPath = "//////" => _fullPath = "/" 42 | if (this->_fullPath.empty()) this->_fullPath = PATH_SEPERATOR; 43 | } 44 | 45 | 46 | 47 | tmp = this->_fullPath.c_str(); 48 | 49 | rv = stat(tmp , &(this->_stat)); 50 | if (rv == 0) { 51 | this->_exist = true ; 52 | } 53 | this->seperatePath(); 54 | } 55 | 56 | FileInfo::~FileInfo(){ 57 | 58 | } 59 | 60 | FileInfo FileInfo::getFileInfo(const char *path){ 61 | FileInfo rv(path); 62 | return rv ; 63 | } 64 | 65 | void FileInfo::seperatePath(){ 66 | size_t pos = std::string::npos ; 67 | if (this->_fullPath.empty()) return ; 68 | if (this->isDirectory()){ 69 | this->_path = this->_fullPath ; 70 | return ; 71 | } 72 | 73 | pos = this->_fullPath.find_last_of(PATH_SEPERATOR) ; 74 | if (pos == std::string::npos){ 75 | // ex) _fullPath='file.ext' => dir: '.' , file: 'file.ext' 76 | this->_path = "."; 77 | this->_fileName = this->_fullPath; 78 | return ; 79 | } 80 | 81 | this->_path = this->_fullPath.substr(0, pos); 82 | if (pos + 1 < this->_fullPath.size()){ 83 | this->_fileName = this->_fullPath.substr(pos +1 ); 84 | } 85 | } 86 | 87 | bool FileInfo::isExist() const { 88 | return this->_exist ; 89 | } 90 | 91 | bool FileInfo::isFile() const { 92 | bool rv = false ; 93 | if (!this->_exist) return rv ; 94 | rv = S_ISREG(this->_stat.st_mode) ; 95 | return rv ; 96 | } 97 | 98 | bool FileInfo::isDirectory() const{ 99 | bool rv = false ; 100 | if (!this->_exist) return rv ; 101 | rv = S_ISDIR(this->_stat.st_mode) ; 102 | return rv ; 103 | } 104 | 105 | bool FileInfo::isReadable() const { 106 | bool rv = false ; 107 | if (!this->_exist) return rv ; 108 | rv = (this->_stat.st_mode & S_IRUSR) == S_IRUSR ; 109 | return rv ; 110 | } 111 | 112 | bool FileInfo::isWritable() const { 113 | bool rv = false ; 114 | if (!this->_exist) return rv ; 115 | rv = (this->_stat.st_mode & S_IWUSR) == S_IWUSR ; 116 | return rv ; 117 | } 118 | 119 | long long FileInfo::length() const{ 120 | long long rv = 0L ; 121 | if (!this->_exist) return rv ; 122 | if (!this->isFile()) return rv ; 123 | return this->_stat.st_size; 124 | } 125 | 126 | const std::string & FileInfo::getFullPath() const{ 127 | return this->_fullPath ; 128 | } 129 | const std::string &FileInfo::getPath() const { 130 | return this->_path ; 131 | } 132 | const std::string &FileInfo::getFileName() const { 133 | return this->_fileName ; 134 | } 135 | 136 | const std::string &FileInfo::getRelativeDir() const { 137 | return this->_relativeDir ; 138 | } 139 | 140 | void FileInfo::setRelativeDir(const char *relativeDir) { 141 | this->_relativeDir = relativeDir; 142 | } 143 | 144 | 145 | 146 | END_FTC_CORE -------------------------------------------------------------------------------- /src/src/core/FileInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_FILE_INFO_H_ 13 | #define _FTC_CORE_FILE_INFO_H_ 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "macro.h" 19 | BEGIN_FTC_CORE 20 | class FileInfo{ 21 | private: 22 | FileInfo(const char *path); 23 | public: 24 | FileInfo(); 25 | virtual ~FileInfo(); 26 | static FileInfo getFileInfo(const char *path); 27 | bool isExist() const ; 28 | bool isFile() const ; 29 | bool isDirectory() const ; 30 | bool isReadable() const ; 31 | bool isWritable() const ; 32 | long long length() const ; 33 | const std::string &getFullPath() const; 34 | const std::string &getPath() const ; 35 | const std::string &getFileName() const ; 36 | const std::string &getRelativeDir() const ; 37 | void setRelativeDir(const char *relativeDir); 38 | private: 39 | void seperatePath(); 40 | 41 | private: 42 | std::string _fullPath ; 43 | std::string _fileName ; 44 | std::string _path ; 45 | std::string _relativeDir ; 46 | struct stat _stat ; 47 | bool _exist ; 48 | }; 49 | END_FTC_CORE 50 | #endif -------------------------------------------------------------------------------- /src/src/core/FileUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_FILE_UTILS_H_ 13 | #define _FTC_CORE_FILE_UTILS_H_ 14 | #include "macro.h" 15 | #include 16 | #include 17 | 18 | BEGIN_FTC_CORE 19 | namespace FileUtils 20 | { 21 | bool fileWrite(const char *filepath, const char *buffer, unsigned int len, int mode = 0); 22 | 23 | bool fileDelete(const char *filepath); 24 | 25 | std::string fileReadString(const char *filepath); 26 | 27 | bool createDirIfnotExist(const char *dirpath); 28 | 29 | bool isFileExist(const char *filepath); 30 | 31 | std::string getFileExtension(const char *filepath); 32 | 33 | std::string getFileNameUniqueIndex(const char *filepath); 34 | } 35 | END_FTC_CORE 36 | 37 | #endif /*_FTC_CORE_FILE_UTILS_H_*/ -------------------------------------------------------------------------------- /src/src/core/JsonUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_JSON_UTILS_H_ 13 | #define _FTC_CORE_JSON_UTILS_H_ 14 | #include 15 | #include 16 | #include "macro.h" 17 | 18 | BEGIN_FTC_CORE 19 | namespace JsonUtils{ 20 | 21 | JsonObject* getObject(JsonNode *node); 22 | JsonArray* getArray(JsonNode *node); 23 | JsonObject* getObject(JsonObject *obj, const char *name); 24 | JsonArray* getArray(JsonObject* obj , const char *name); 25 | const char* getString(JsonObject* obj , const char *name); 26 | std::string getStdString(JsonObject* obj , const char *name); 27 | bool getBool(JsonObject *obj, const char *name , bool dv = false); 28 | int getInt(JsonObject *obj, const char *name , int dv = 0); 29 | 30 | 31 | const char* getString(JsonNode* node , const char *name); 32 | std::string getStdString(JsonNode* node , const char *name); 33 | bool getBool(JsonNode *node, const char *name , bool dv = false); 34 | int getInt(JsonNode *node, const char *name , int dv = 0); 35 | JsonObject* getObject(JsonNode *node, const char *name); 36 | JsonArray* getArray(JsonNode *node, const char *name); 37 | int getArraySize(JsonNode *node, const char *name); 38 | JsonNode* getNode(JsonNode* node, const char *name); 39 | 40 | 41 | JsonObject *createObject(); 42 | JsonObject *setString(JsonObject *obj , const char *key, const char* value); 43 | JsonObject *setString(JsonObject *obj ,const std::string& key, const std::string& value); 44 | JsonObject *setInt(JsonObject *obj , const char *key, const int value); 45 | JsonObject *setInt(JsonObject *obj ,const std::string& key, const int value); 46 | JsonObject *setBoolean(JsonObject *obj , const char *key, const bool value); 47 | JsonObject *setBoolean(JsonObject *obj ,const std::string& key, const bool value); 48 | JsonObject *setObject(JsonObject *obj ,const char *key, JsonObject *value); 49 | JsonObject *setObject(JsonObject *obj ,const std::string& key, JsonObject *value); 50 | JsonObject *setArray(JsonObject *obj, const char *key, JsonArray *value); 51 | JsonObject *setArray(JsonObject *obj, const std::string& key, JsonArray *value); 52 | 53 | JsonArray *createArray() ; 54 | JsonArray *addString(JsonArray *arr , const char *value); 55 | JsonArray *addString(JsonArray *arr , const std::string& value); 56 | JsonArray *addObject(JsonArray *arr , JsonObject *obj); 57 | 58 | JsonNode* objectToNode(JsonObject **obj); 59 | std::string jsonToString(JsonObject **obj); 60 | 61 | 62 | 63 | } 64 | END_FTC_CORE 65 | 66 | #endif /* _FTC_CORE_JSON_UTILS_H_ */ -------------------------------------------------------------------------------- /src/src/core/Logger.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "Logger.h" 17 | #include "FileInfo.h" 18 | #include "TimeUtils.h" 19 | #include "FileUtils.h" 20 | #include "model/GlobalVar.h" 21 | 22 | #define MAX_LOG_LENGTH (16 * 1024) 23 | 24 | static std::mutex s_mtx; 25 | 26 | BEGIN_FTC_CORE 27 | namespace Logger{ 28 | 29 | void logWrite(const char *log) { 30 | std::unique_lock lk(s_mtx); 31 | ClientConfig &clientConfig = GlobalVar::getClientConfig(); 32 | FileInfo fiConfig = FileInfo::getFileInfo(clientConfig.getConfigDirPath().c_str()); 33 | FileInfo fiLog; 34 | std::stringstream ss; 35 | std::string filepath, writeData; 36 | std::tm tm = TimeUtils::now(); 37 | 38 | if (! fiConfig.isExist()) { 39 | return; 40 | } 41 | 42 | fiLog = FileInfo::getFileInfo(std::string(fiConfig.getFullPath() + "/log").c_str()); 43 | 44 | if (! fiLog.isExist()) { 45 | if (mkdir(fiLog.getFullPath().c_str(), 0755) != 0) { 46 | return; 47 | } 48 | } 49 | 50 | // 파일이름 51 | ss << fiLog.getFullPath(); 52 | ss << "/"; 53 | ss << "FTC_"; 54 | ss << TimeUtils::getDateFormat(tm, "%Y-%02m-%02d"); 55 | ss << ".txt"; 56 | filepath = ss.str(); 57 | ss.str(""); 58 | 59 | // 로그포멧 60 | ss << "["; 61 | ss << TimeUtils::getDateFormat(tm, "%Y-%02m-%02d %H:%M:%S"); 62 | ss << "] "; 63 | ss << "["; 64 | ss << "0x" << std::uppercase << std::setfill('0') << std::setw(sizeof(unsigned long)) << std::hex << pthread_self(); /*thread id*/ 65 | ss << "] "; 66 | ss << log; 67 | writeData = ss.str(); 68 | 69 | // 저장 70 | FileUtils::fileWrite(filepath.c_str(), (char*)writeData.c_str(), strlen(writeData.c_str()), 2); 71 | } 72 | 73 | void log(const char * format, ...) 74 | { 75 | int bufferSize = MAX_LOG_LENGTH; 76 | char* buf = nullptr; 77 | int nret = 0; 78 | va_list args; 79 | 80 | do 81 | { 82 | buf = new (std::nothrow) char[bufferSize]; 83 | if (buf == nullptr) 84 | return; 85 | va_start(args, format); 86 | nret = vsnprintf(buf, bufferSize - 3, format, args); 87 | va_end(args); 88 | 89 | if (nret >= 0) 90 | { 91 | if (nret <= bufferSize - 3) 92 | { 93 | break; 94 | } 95 | else 96 | { 97 | bufferSize = nret + 3; 98 | delete[] buf; 99 | } 100 | } 101 | else 102 | { 103 | bufferSize *= 2; 104 | delete[] buf; 105 | } 106 | } while (true); 107 | buf[nret] = '\n'; 108 | buf[++nret] = '\0'; 109 | 110 | #ifdef FTC_DEBUG 111 | fprintf(stdout, "%s", buf); 112 | fflush(stdout); 113 | #endif 114 | logWrite(buf); 115 | 116 | 117 | delete[] buf; 118 | } 119 | } 120 | END_FTC_CORE -------------------------------------------------------------------------------- /src/src/core/Logger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_LOGGER_H_ 13 | #define _FTC_CORE_LOGGER_H_ 14 | 15 | #include 16 | #include "macro.h" 17 | 18 | #define FTC_LOG(format, ... ) Ftc::Core::Logger::log(format , ##__VA_ARGS__) 19 | 20 | #ifdef FTC_DEBUG 21 | #define FTC_LOG_DEBUG(format , ... ) Ftc::Core::Logger::log(format , ##__VA_ARGS__) 22 | #else 23 | #define FTC_LOG_DEBUG( ... ) do{}while(0) 24 | #endif 25 | 26 | BEGIN_FTC_CORE 27 | namespace Logger{ 28 | void log(const char *format , ... ); 29 | } 30 | END_FTC_CORE 31 | 32 | 33 | #endif -------------------------------------------------------------------------------- /src/src/core/NetUtils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include "StringUtils.h" 18 | #include "NetUtils.h" 19 | 20 | BEGIN_FTC_CORE 21 | 22 | namespace NetUtils 23 | { 24 | 25 | 26 | struct ifaddrs* getIfAddrs(struct ifaddrs* ifaddrs , const char* name, int family){ 27 | struct ifaddrs* rv = NULL ; 28 | struct ifaddrs *ifa = NULL; 29 | if (ifaddrs == NULL || name == NULL) return rv ; 30 | 31 | for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next){ 32 | if (ifa->ifa_name == NULL || ifa->ifa_addr->sa_family != family) continue ; 33 | 34 | if (strcmp(ifa->ifa_name, name) == 0){ 35 | rv = ifa ; 36 | break ; 37 | } 38 | } 39 | return rv ; 40 | } 41 | 42 | void setInetAddr(NetInfo& info , struct ifaddrs* ifa){ 43 | char host[NI_MAXHOST]; 44 | if (ifa == NULL) return ; 45 | 46 | if (getnameinfo(ifa->ifa_addr , sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL , 0 , NI_NUMERICHOST) != 0) return ; 47 | info.inetAddr = host ; 48 | } 49 | 50 | bool setNetInfo(std::list &list, struct ifaddrs *ifaddrs) 51 | { 52 | bool rv = false; 53 | struct ifaddrs *ifa = NULL; 54 | struct ifaddrs *inet = NULL; 55 | if (ifaddrs == NULL) 56 | return rv; 57 | 58 | for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next) 59 | { 60 | NetInfo info ; 61 | char temp[256]; 62 | if ((ifa->ifa_addr) && (ifa->ifa_addr->sa_family == AF_PACKET)) 63 | { 64 | struct sockaddr_ll *s = (struct sockaddr_ll *)ifa->ifa_addr; 65 | 66 | if (s == NULL || ifa->ifa_name == NULL || strcmp(ifa->ifa_name, "lo") == 0) continue; 67 | info.ifname = ifa->ifa_name ; 68 | 69 | for (int i = 0 ; i < s->sll_halen ; i++){ 70 | snprintf(temp, 256, "%02X", s->sll_addr[i]); 71 | info.macAddr.append(temp); 72 | if ( i+1 != s->sll_halen) { 73 | info.macAddr.append(":"); 74 | } 75 | } 76 | 77 | inet = getIfAddrs(ifaddrs, ifa->ifa_name , AF_INET); 78 | if (inet != NULL){ 79 | setInetAddr(info, inet); 80 | } 81 | 82 | list.push_back(info); 83 | } 84 | } 85 | rv = true ; 86 | return rv; 87 | } 88 | 89 | std::list getNetInfo() 90 | { 91 | std::list rv; 92 | 93 | struct ifaddrs *ifaddrs = NULL; 94 | 95 | if (getifaddrs(&ifaddrs) < 0) 96 | { 97 | goto DONE; 98 | } 99 | 100 | if (ifaddrs == NULL) 101 | { 102 | return rv; 103 | } 104 | 105 | if (!setNetInfo(rv, ifaddrs)) 106 | { 107 | goto DONE; 108 | } 109 | 110 | DONE: 111 | if (ifaddrs != NULL) 112 | { 113 | freeifaddrs(ifaddrs); 114 | ifaddrs = NULL; 115 | } 116 | 117 | return rv; 118 | } 119 | } // namespace NetUtils 120 | 121 | END_FTC_CORE -------------------------------------------------------------------------------- /src/src/core/NetUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_NET_UTILS_H_ 13 | #define _FTC_CORE_NET_UTILS_H_ 14 | 15 | #include "macro.h" 16 | #include 17 | #include 18 | 19 | typedef struct _NetInfo{ 20 | std::string ifname ; 21 | std::string macAddr ; 22 | std::string inetAddr ; 23 | } NetInfo ; 24 | 25 | BEGIN_FTC_CORE 26 | namespace NetUtils{ 27 | std::list getNetInfo(); 28 | } 29 | END_FTC_CORE 30 | 31 | 32 | #endif -------------------------------------------------------------------------------- /src/src/core/Request.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_REQUEST_H_ 2 | #define _FTC_REQUEST_H_ 3 | #include 4 | #include 5 | #include 6 | #include "macro.h" 7 | #include "Response.h" 8 | 9 | BEGIN_FTC_CORE 10 | 11 | namespace Request{ 12 | typedef struct _InsertPackFileNetworkParam 13 | { 14 | std::string receive_network; 15 | std::string download_expire_dt; 16 | } InsertPackFileNetworkParam; 17 | 18 | 19 | void init(); 20 | bool requestLoginLocation(); 21 | bool requestLogin(const char *userId , const char *passwd, bool auto_login, void *user_data = nullptr); 22 | bool requestLogout(bool isSessionTimeout = false); 23 | bool requestUsersCnt(); 24 | bool requestSelectCsClipboardList(); 25 | 26 | /** 27 | * File Upload Ready 28 | */ 29 | std::shared_ptr requestInitPackFilePop(); 30 | std::shared_ptr requestSelectEnableSendNetworkList(); 31 | std::shared_ptr requestSelectNetworkSelectionUserList(const char *network_id, const char *user_id); 32 | std::shared_ptr requestGetUserExistCheckResult(const char *id_list); 33 | std::shared_ptr requestGetMaxDayUploadFileSizeResult(int send_file_sum, const char *network_id); 34 | std::shared_ptr requestGetUserCntResult(const char *receive_id); 35 | std::shared_ptr requestGetUserFileSumCheckResult(const char *receive_id, int send_file_sum); 36 | std::shared_ptr requestDeleteReceiveFileList(); 37 | 38 | /** 39 | * File Upload 40 | */ 41 | std::shared_ptr requestFileUploadFileName(const std::string &fileName); 42 | std::shared_ptr requestFileUpload(const char *filename , const char *serverFileName, unsigned char **content , long long size , long long offset, long long totalSize, const char *sha); 43 | std::shared_ptr requestFileUploadApi(const char *filename, unsigned char **content, long long size, const char *sys_name, const char *to_network_ip); 44 | 45 | /** 46 | * File Upload End 47 | */ 48 | std::shared_ptr requestFileUploadCheckBefore(int count); 49 | bool requestFileUploadCheck(const char *receive_network, std::list &uploadedFilesList, std::list &requestInfoFileListUIDs, const char *event_name, gpointer user_data); 50 | std::shared_ptr requestFileUploadCheckAfter(const char *receive_network, std::list &requestInfoFileListUIDs); 51 | std::shared_ptr requestInsertPackFile(const char *request_title, const char *request_text, bool is_approval_officer, const char *receive_id_list_hidden, 52 | std::list network_params, std::map approval_lines, std::list strFileList); 53 | 54 | /** 55 | * File Upload Delete 56 | */ 57 | std::shared_ptr requestDeleteUploadGarbage(std::list uploadedFilesList); 58 | std::shared_ptr requestInsertPackFileDelete(std::list strFileList); 59 | 60 | /** 61 | * File Recv 62 | */ 63 | std::shared_ptr requestSelectReceiveFileList_ajax(const unsigned int page, const char *from_date, const char* to_date); 64 | std::shared_ptr requestSelectPackFile_ajax(const char *request_info_uid, const char *list_type); 65 | bool requestLeftmenuCount_ajax(const char *list_type, const char *from_date, const char *to_date); 66 | 67 | /** 68 | * File History 69 | */ 70 | std::shared_ptr requestSelectSendFileList_ajax(const unsigned int page, const char *from_date, const char* to_date); 71 | std::shared_ptr requestSelectPackFileNetwork_ajax(const char *request_info_uid, const char *from_network_id, const char *to_network_id, const char *list_type); 72 | 73 | /** 74 | * File Download 75 | */ 76 | std::shared_ptr requestInitPackFileDownload_ajax(const char *request_info_uid, const char *ipaddress); 77 | bool requestFileDownload_isCsharp(const char *request_info_file_list_uid, const char *from_network_id, const char *to_network_id, const char *file_path); 78 | std::shared_ptr requestSelectNotDownloadFileList(const char *request_dt); 79 | 80 | /** 81 | * PCURL 82 | */ 83 | std::shared_ptr requestSelectPcUrlProxy(); 84 | } 85 | END_FTC_CORE 86 | #endif /* _FTC_REQUEST_H_ */ -------------------------------------------------------------------------------- /src/src/core/Response.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include "Response.h" 13 | 14 | BEGIN_FTC_CORE 15 | 16 | Response::Response(): 17 | _node(NULL), 18 | _status(0), 19 | _isSessionExpired(false) 20 | { 21 | 22 | } 23 | 24 | Response::Response(const std::string &url): 25 | _node(NULL), 26 | _status(0), 27 | _url(url), 28 | _isSessionExpired(false){ 29 | 30 | } 31 | 32 | Response::Response(const Response &resp){ 33 | this->_status = resp._status ; 34 | this->_respMessage = resp._respMessage; 35 | this->_node = resp._node ; 36 | if (this->_node){ 37 | json_node_ref(this->_node); 38 | } 39 | } 40 | 41 | Response::~Response(){ 42 | if (this->_node != NULL){ 43 | json_node_unref(this->_node); 44 | } 45 | } 46 | 47 | void Response::setJsonNode(JsonNode* node){ 48 | if (this->_node != NULL){ 49 | json_node_unref(this->_node); 50 | this->_node = NULL ; 51 | } 52 | this->_node = node ; 53 | if (this->_node){ 54 | json_node_ref(this->_node); 55 | } 56 | 57 | } 58 | 59 | JsonNode *Response::getJsonNode() const{ 60 | return this->_node ; 61 | } 62 | 63 | void Response::setResponse(const std::string &respMessage) { 64 | this->_respMessage = respMessage ; 65 | } 66 | void Response::setResponse(const char *respMessage) { 67 | this->_respMessage = respMessage ; 68 | } 69 | void Response::setResponse(const char *respMessage, const int messageLen) { 70 | if (respMessage == NULL || messageLen <= 0) return ; 71 | this->_respMessage = std::string(respMessage, messageLen); 72 | } 73 | void Response::setHeaderMap(const char *headerName, const char *headerValue) { 74 | this->_respHeader.insert(std::pair(headerName, headerValue)); 75 | } 76 | 77 | void Response::setExpiredSession(bool isSessionExpired) { 78 | this->_isSessionExpired = isSessionExpired; 79 | } 80 | 81 | const std::string &Response::getResponseMessage(){ 82 | return this->_respMessage ; 83 | } 84 | const std::string Response::getResponseHeaderValue(const char *headerName) { 85 | std::string rv; 86 | auto it = this->_respHeader.find(headerName); 87 | if (it != this->_respHeader.end()) { 88 | rv = it->second; 89 | } 90 | return rv; 91 | } 92 | 93 | void Response::setUrl(const char *url){ 94 | if (url == NULL) return ; 95 | this->_url = url ; 96 | } 97 | const std::string &Response::getUrl(){ 98 | return this->_url; 99 | } 100 | 101 | bool Response::isSuccess(){ 102 | return ((this->_status) >= 200 && (this->_status) < 300) ; 103 | } 104 | 105 | bool Response::isExpiredSession(){ 106 | return this->_isSessionExpired; 107 | } 108 | 109 | END_FTC_CORE 110 | 111 | -------------------------------------------------------------------------------- /src/src/core/Response.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_RESPONSE_H_ 13 | #define _FTC_CORE_RESPONSE_H_ 14 | #include "macro.h" 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | 21 | BEGIN_FTC_CORE 22 | 23 | class Response{ 24 | public: 25 | Response(); 26 | Response(const std::string &url); 27 | Response(const Response &resp); 28 | virtual ~Response(); 29 | void setJsonNode(JsonNode* node); 30 | JsonNode *getJsonNode() const; 31 | void setUrl(const char *url); 32 | const std::string &getUrl(); 33 | void setResponse(const std::string &respMessage); 34 | void setResponse(const char *respMessage); 35 | void setResponse(const char *respMessage, const int messageLen); 36 | void setHeaderMap(const char *headerName, const char *headerValue); 37 | void setExpiredSession(bool isSessionExpired); 38 | const std::string &getResponseMessage(); 39 | const std::string getResponseHeaderValue(const char *headerName); 40 | bool isSuccess() ; 41 | bool isExpiredSession(); 42 | FTC_SYNTHESIZE(int , _status, Status) 43 | private: 44 | JsonNode* _node ; 45 | std::string _url; 46 | std::string _respMessage ; 47 | bool _isSessionExpired ; 48 | std::unordered_map _respHeader ; 49 | }; 50 | 51 | typedef struct _AsyncResult { 52 | Response *resp; 53 | gpointer user_data; 54 | } AsyncResult; 55 | 56 | END_FTC_CORE 57 | #endif /* _FTC_CORE_RESPONSE_H_ */ -------------------------------------------------------------------------------- /src/src/core/SocketServer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef __FTC_CORE_SOCKET_SERVER_H__ 13 | #define __FTC_CORE_SOCKET_SERVER_H__ 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "macro.h" 19 | 20 | BEGIN_FTC_CORE 21 | 22 | 23 | 24 | class SocketServer{ 25 | 26 | private : 27 | typedef struct _Socket { 28 | GSocketService *service; 29 | GSocketAddress *listening_addr; 30 | int port; 31 | 32 | _Socket() { 33 | service = NULL; 34 | listening_addr = NULL; 35 | port = 0; 36 | } 37 | } Socket; 38 | public: 39 | static SocketServer *getInstance(); 40 | static void destroyInstance(); 41 | 42 | bool start(); 43 | bool work(std::string data); 44 | 45 | virtual ~SocketServer(); 46 | private: 47 | SocketServer(); 48 | 49 | bool start(int port); 50 | bool stop(); 51 | 52 | 53 | bool clipboard(std::string &data, std::vector &splitData); 54 | bool urlRedirection(std::string &data, std::vector &splitData); 55 | bool autoDownload(std::string &data, std::vector &splitData); 56 | 57 | std::list downloadFile(const std::string &requestInfoUid, const std::string &localIp, const std::string &dir); 58 | 59 | private: 60 | static SocketServer *s_instance ; 61 | static volatile bool s_stop ; 62 | 63 | std::vector _sockets; 64 | }; 65 | 66 | END_FTC_CORE 67 | 68 | #endif -------------------------------------------------------------------------------- /src/src/core/StringUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | 13 | #ifndef _FTC_CORE_STRING_UTILS_H_ 14 | #define _FTC_CORE_STRING_UTILS_H_ 15 | #include 16 | #include 17 | #include 18 | #include "macro.h" 19 | BEGIN_FTC_CORE 20 | namespace StringUtils { 21 | void ltrim(std::string &s); 22 | void ltrim(std::string &s, char remove); 23 | void rtrim(std::string &s); 24 | void rtrim(std::string &s, char remove); 25 | void trim(std::string &s); 26 | void trim(std::string &s, char remove); 27 | int getInt(const std::string &s); 28 | int getInt(const char* s); 29 | bool getBool(const std::string &s); 30 | bool getBool(const char* s); 31 | void replace(std::string &s, const std::string &p, const std::string &r); 32 | std::list split(std::string &s, const char p); 33 | std::vector splitToVector(std::string &s, const char p); 34 | void format(std::string &s, const std::string fmt, ...); 35 | std::string format(const std::string fmt, ...); 36 | bool endsWith(const std::string& str, const char* suffix, unsigned suffixLen); 37 | bool endsWith(const std::string& str, const char* suffix); 38 | bool startsWith(const std::string& str, const char* prefix, unsigned prefixLen); 39 | bool startsWith(const std::string& str, const char* prefix); 40 | } 41 | END_FTC_CORE 42 | #endif /* _FTC_CORE_STRING_UTILS_H_ */ 43 | -------------------------------------------------------------------------------- /src/src/core/TimeUtils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "TimeUtils.h" 21 | #include "StringUtils.h" 22 | 23 | BEGIN_FTC_CORE 24 | 25 | namespace TimeUtils 26 | { 27 | std::tm now() 28 | { 29 | std::tm rv; 30 | std::time_t now_date = std::time(NULL); 31 | localtime_r(&now_date, &rv); 32 | return rv; 33 | } 34 | 35 | std::tm addDay(std::tm &tm, int day) 36 | { 37 | std::tm rv; 38 | std::time_t time = std::mktime(&tm); 39 | int day_abs = abs(day); 40 | 41 | if (day > 0) { 42 | time += 60 * 60 * 24 * day_abs; 43 | } else { 44 | time -= 60 * 60 * 24 * day_abs; 45 | } 46 | 47 | localtime_r(&time, &rv); 48 | return rv; 49 | } 50 | 51 | std::string getDateFormat(std::tm &tm, const char *format) 52 | { 53 | char buffer[256] = { 0, }; 54 | 55 | if (! format) { 56 | return ""; 57 | } 58 | 59 | strftime(buffer, 256, format, &tm); 60 | 61 | return buffer; 62 | } 63 | 64 | std::tm dateFormatToTm(const char *date/*yyyymmdd*/) 65 | { 66 | 67 | } 68 | } // namespace TimeUtils 69 | 70 | END_FTC_CORE -------------------------------------------------------------------------------- /src/src/core/TimeUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | 13 | #ifndef _FTC_CORE_TIME_UTILS_H_ 14 | #define _FTC_CORE_TIME_UTILS_H_ 15 | #include "StringUtils.h" 16 | #include "macro.h" 17 | #include 18 | 19 | BEGIN_FTC_CORE 20 | namespace TimeUtils { 21 | std::tm now(); 22 | std::tm addDay(std::tm &tm, int day); 23 | std::string getDateFormat(std::tm &tm, const char *format); 24 | std::tm dateFormatToTm(const char *date/*yyyymmdd*/); 25 | } 26 | END_FTC_CORE 27 | #endif /* _FTC_CORE_TIME_UTILS_H_ */ 28 | -------------------------------------------------------------------------------- /src/src/core/UrlRedirection.cpp: -------------------------------------------------------------------------------- 1 | #include "UrlRedirection.h" 2 | #include "FileUtils.h" 3 | #include "TimeUtils.h" 4 | #include "Request.h" 5 | #include "sys_utils.h" 6 | #include "Logger.h" 7 | #include "JsonUtils.h" 8 | #include "CommonUtils.h" 9 | #include "model/GlobalVar.h" 10 | #include "model/Properties.h" 11 | 12 | #include 13 | 14 | 15 | BEGIN_FTC_CORE 16 | 17 | bool openUrl(const char *url) 18 | { 19 | std::string command, urlStr; 20 | 21 | if (! url) { 22 | return false; 23 | } 24 | 25 | urlStr = url; 26 | 27 | if ((urlStr.find("http://") == std::string::npos) && (urlStr.find("https://") == std::string::npos)) { 28 | urlStr = urlStr.insert(0, "http://"); 29 | } 30 | 31 | return !ftc_open_url(urlStr); 32 | } 33 | 34 | bool loadUrl(const char *filepath) 35 | { 36 | std::string readStr, url, command; 37 | std::string message; 38 | EventManager *event_mgr = EventManager::getInstance(); 39 | bool rv = false; 40 | 41 | if (! filepath) { 42 | goto END; 43 | } 44 | 45 | readStr = FileUtils::fileReadString(filepath); 46 | if (readStr.length() <= 0) { 47 | goto END; 48 | } 49 | 50 | FileUtils::fileDelete(filepath); 51 | 52 | url = readStr; 53 | 54 | if (openUrl(url.c_str()) == false) { 55 | goto END; 56 | } 57 | 58 | rv = true; 59 | END: 60 | if (event_mgr != nullptr) { 61 | if (rv) { 62 | // URL이 수신되었습니다. 63 | message = "URL이 수신되었습니다."; 64 | } else { 65 | // 처리할 수 없는 url입니다. 66 | message = "처리할 수 없는 url입니다."; 67 | } 68 | 69 | CommonUtils::callNotificationEvent(message); 70 | } 71 | 72 | return rv; 73 | } 74 | 75 | static void sendUrlThread(char *url) 76 | { 77 | std::string filename; 78 | char *buffer = NULL; 79 | const char *err = NULL; 80 | bool rv = false; 81 | 82 | try { 83 | filename = "urlredirect"; 84 | buffer = new char[strlen(url) + 1]; 85 | memset(buffer, 0, strlen(url) + 1); 86 | memcpy(buffer, url, strlen(url)); 87 | 88 | auto resp = Request::requestFileUploadApi(filename.c_str(), (unsigned char**)&buffer, strlen(url), NULL, NULL); 89 | if (! resp->isSuccess()) { 90 | throw std::runtime_error("UploadApi HTTP 오류: " + resp->getResponseMessage()); 91 | } 92 | 93 | CommonUtils::callNotificationEvent("URL Redirection을 전송하였습니다."); 94 | } catch(const std::runtime_error& e) { 95 | err = e.what(); 96 | 97 | if (strlen(err) > 0) { 98 | FTC_LOG("URL Redirection 전송 실패 : %s", err); 99 | 100 | CommonUtils::callMessageBoxEvent(err); 101 | } 102 | } 103 | 104 | if (buffer) { 105 | delete[] buffer; 106 | buffer = NULL; 107 | } 108 | 109 | if (url) { 110 | g_free(url); 111 | url = NULL; 112 | } 113 | } 114 | 115 | bool sendUrl(const char *url) 116 | { 117 | std::thread thread; 118 | gchar *alloc_url = NULL; 119 | bool rv = false; 120 | 121 | if (! url) { 122 | return rv; 123 | } 124 | 125 | alloc_url = g_strdup(url); 126 | 127 | thread = std::thread(sendUrlThread, alloc_url); 128 | thread.detach(); 129 | 130 | rv = true; 131 | return rv; 132 | } 133 | 134 | 135 | END_FTC_CORE 136 | 137 | -------------------------------------------------------------------------------- /src/src/core/UrlRedirection.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_URL_REDIRECTION_H_ 2 | #define _FTC_CORE_URL_REDIRECTION_H_ 3 | 4 | #include "macro.h" 5 | #include 6 | 7 | 8 | BEGIN_FTC_CORE 9 | 10 | bool openUrl(const char *url); 11 | 12 | bool loadUrl(const char *filepath); 13 | 14 | bool sendUrl(const char *url); 15 | 16 | END_FTC_CORE 17 | #endif /* _FTC_CORE_URL_REDIRECTION_H_ */ 18 | -------------------------------------------------------------------------------- /src/src/core/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_BASE64_H_ 13 | #define _FTC_CORE_BASE64_H_ 14 | unsigned int base64_decode_out(const unsigned char *in, unsigned int in_len, unsigned char **out); 15 | unsigned int base64_decode(const unsigned char *in, unsigned int in_len, unsigned char * out , unsigned int out_len); 16 | unsigned int get_base64_decode_size(unsigned int in_len); 17 | unsigned int base64_encode_out(const unsigned char *in, unsigned int in_len, char **out); 18 | unsigned int base64_encode(const unsigned char *in, unsigned int in_len, char * out , unsigned int out_len); 19 | unsigned int get_base64_encode_size(unsigned int in_len); 20 | 21 | int get_test(); 22 | #endif /* _FTC_CORE_BASE64_H_ */ 23 | -------------------------------------------------------------------------------- /src/src/core/core.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include 13 | #include "core.h" 14 | 15 | USING_FTC_CORE; 16 | 17 | static bool s_core_init = false ; 18 | 19 | bool ftc_core_init(){ 20 | bool rv = false ; 21 | EventManager *evtManager = NULL ; 22 | SocketServer *sockServer = NULL ; 23 | 24 | GlobalVar::init(); 25 | evtManager = EventManager::getInstance(); 26 | sockServer = SocketServer::getInstance(); 27 | 28 | ftc_system_init(); 29 | 30 | rv = true ; 31 | s_core_init = true ; 32 | return rv ; 33 | } 34 | 35 | 36 | void ftc_core_dispose(){ 37 | if (!s_core_init) return ; 38 | EventManager::getInstance()->destroyInstance(); 39 | SocketServer::getInstance()->destroyInstance(); 40 | 41 | http_dispose(); 42 | GlobalVar::dispose(); 43 | s_core_init = false ; 44 | } 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/src/core/core.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_CORE_H_ 13 | #define _FTC_CORE_CORE_H_ 14 | 15 | 16 | #include "model/User.h" 17 | #include "model/Properties.h" 18 | #include "model/GlobalVar.h" 19 | #include "model/GlobalStruct.h" 20 | #include "transfer/UploadFile.h" 21 | #include "transfer/Upload.h" 22 | #include "transfer/Download.h" 23 | #include "transfer/DownloadRequest.h" 24 | #include "Event.h" 25 | #include "EventManager.h" 26 | #include "Response.h" 27 | #include "JsonUtils.h" 28 | #include "FileInfo.h" 29 | #include "http.h" 30 | #include "sys_utils.h" 31 | #include "urlencode.h" 32 | #include "Logger.h" 33 | #include "SocketServer.h" 34 | #include "Request.h" 35 | #include "macro.h" 36 | 37 | bool ftc_core_init(); 38 | void ftc_core_dispose(); 39 | 40 | 41 | #endif /* _FTC_CORE_CORE_H_ */ -------------------------------------------------------------------------------- /src/src/core/http.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_HTTP_H_ 13 | #define _FTC_CORE_HTTP_H_ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include "Response.h" 22 | 23 | USING_FTC_CORE ; 24 | 25 | 26 | 27 | typedef std::multimap HTTP_PARAM ; 28 | typedef std::unordered_map HTTP_HEADER ; 29 | void http_add_param(HTTP_PARAM ¶m , std::string key, std::string value); 30 | void http_add_header(HTTP_HEADER &header , std::string key, std::string value); 31 | 32 | std::shared_ptr http_send_get(const char *url, const HTTP_PARAM *param = NULL, const HTTP_HEADER *header = NULL); 33 | std::shared_ptr http_send_post(const char *url, const HTTP_PARAM *param = NULL, const HTTP_HEADER *header = NULL, bool crypto = false); 34 | std::shared_ptr http_send_file_multipart(const char *url , const char *filename , unsigned char **content , long long size , long long offset, long long totalSize, const HTTP_PARAM *param = NULL , const HTTP_HEADER *header = NULL, bool crypto = false); 35 | std::shared_ptr http_send_file_stream(const char *url, const char *filename, unsigned char **content , long long size, const char *type, const char *enckey, const HTTP_PARAM *param = NULL , const HTTP_HEADER *header = NULL, bool crypto = false); 36 | bool http_download_file(const char *url, const HTTP_PARAM *param, const HTTP_HEADER *header, const char *filepath, bool crypto = false); 37 | bool http_send_post_async_task(const char *url , const char *eventName , gpointer eventUserData , HTTP_PARAM *param , const HTTP_HEADER *header, bool crypto); 38 | GSList *http_get_cookie_list(); 39 | void http_clear_cookies() ; 40 | int http_dispose(); 41 | 42 | #endif -------------------------------------------------------------------------------- /src/src/core/keybinder.h: -------------------------------------------------------------------------------- 1 | /* bind.h 2 | * Copyright (C) 2008 Alex Graveley 3 | * Copyright (C) 2010 Ulrik Sverdrup 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | #ifndef __KEY_BINDER_H__ 25 | #define __KEY_BINDER_H__ 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef void (* KeybinderHandler) (const char *keystring, void *user_data); 32 | 33 | void keybinder_init (void); 34 | 35 | void keybinder_set_use_cooked_accelerators (gboolean use_cooked); 36 | 37 | gboolean keybinder_bind (const char *keystring, 38 | KeybinderHandler handler, 39 | void *user_data); 40 | 41 | gboolean 42 | keybinder_bind_full (const char *keystring, 43 | KeybinderHandler handler, 44 | void *user_data, 45 | GDestroyNotify notify); 46 | 47 | void keybinder_unbind (const char *keystring, 48 | KeybinderHandler handler); 49 | 50 | void keybinder_unbind_all (const char *keystring); 51 | 52 | guint32 keybinder_get_current_event_time (void); 53 | 54 | gboolean keybinder_supported (void); 55 | 56 | G_END_DECLS 57 | 58 | #endif /* __KEY_BINDER_H__ */ 59 | 60 | -------------------------------------------------------------------------------- /src/src/core/macro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | 13 | #ifndef _FTC_CORE_MACRO_H_ 14 | #define _FTC_CORE_MACRO_H_ 15 | 16 | #define BEGIN_FTC \ 17 | namespace Ftc \ 18 | { 19 | #define END_FTC } 20 | #define BEGIN_FTC_CORE \ 21 | namespace Ftc \ 22 | { \ 23 | namespace Core \ 24 | { 25 | #define END_FTC_CORE \ 26 | } \ 27 | } 28 | 29 | #define USING_FTC using namespace Ftc 30 | #define USING_FTC_CORE using namespace Ftc::Core 31 | 32 | 33 | #define FTC_SYNTHESIZE(varType, varName, funName)\ 34 | protected: varType varName; public: virtual inline varType get##funName() const { return varName; } virtual inline void set##funName(varType var){ varName = var; } 35 | 36 | #define FTC_SYNTHESIZE_PASS_BY_REF(varType, varName, funName)\ 37 | protected: varType varName; public: virtual inline varType& get##funName() { return varName; } virtual inline void set##funName(const varType& var){ varName = var; } 38 | 39 | #define FTC_SYNTHESIZE_READONLY(varType, varName, funName)\ 40 | protected: varType varName; public: virtual inline varType get##funName() const { return varName; } 41 | 42 | #define FTC_SYNTHESIZE_READONLY_PASS_BY_REF(varType, varName, funName)\ 43 | protected: varType varName; public: virtual inline const varType& get##funName() const { return varName; } 44 | 45 | 46 | 47 | #define HUNE_CALLBACK_OBJECT_0(__func__, __target__, ...) std::bind(&__func__, __target__, ##__VA_ARGS__) 48 | #define HUNE_CALLBACK_OBJECT_1(__func__, __target__, ...) std::bind(&__func__, __target__, std::placeholders::_1, ##__VA_ARGS__) 49 | #define HUNE_CALLBACK_OBJECT_2(__func__, __target__, ...) std::bind(&__func__, __target__, std::placeholders::_1, std::placeholders::_2, ##__VA_ARGS__) 50 | 51 | #define HUNE_CALLBACK_CLS_STATIC_0(__func__, ...) std::bind(&__func__, ##__VA_ARGS__) 52 | #define HUNE_CALLBACK_CLS_STATIC_1(__func__, ...) std::bind(&__func__, std::placeholders::_1, ##__VA_ARGS__) 53 | #define HUNE_CALLBACK_CLS_STATIC_2(__func__, ...) std::bind(&__func__, std::placeholders::_1, std::placeholders::_2, ##__VA_ARGS__) 54 | 55 | 56 | 57 | #endif /* _FTC_CORE_MACRO_H_ */ -------------------------------------------------------------------------------- /src/src/core/model/ClientConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_MODEL_CLIENT_CONFIG_H_ 13 | #define _FTC_CORE_MODEL_CLIENT_CONFIG_H_ 14 | #include 15 | #include 16 | #include "../macro.h" 17 | 18 | /** 19 | * FTC C# Client 환경 설정 파일 정보 20 | **/ 21 | #define FTC_GSCHEMA_ID "org.hunesion.app" 22 | 23 | // GSETTING KEY 24 | #define FTC_URL "ftcurl" 25 | #define FTC_SERVER "ftcserver" 26 | #define CLIPBOARD_PORT "clipboardport" 27 | #define FILE_UPLOAD_THREADCNT "fileuploadthreadcnt" 28 | #define FILE_DOWNLOAD_THREADCNT "filedownloadthreadcnt" 29 | 30 | 31 | 32 | 33 | BEGIN_FTC_CORE 34 | class ClientConfig 35 | { 36 | public: 37 | ClientConfig(); 38 | virtual ~ClientConfig(); 39 | 40 | void init(); 41 | void dispose(); 42 | 43 | std::string getConfigDirPath() const; 44 | std::string getUserDownloadDirPath() const; 45 | std::string getUserHomeDirPath() const; 46 | 47 | bool existConfigDir() const; 48 | private: 49 | bool gschemaRead(); 50 | bool gschemaWrite(); 51 | bool configRead(); 52 | bool configWrite(); 53 | 54 | GKeyFile* loadConfigFile(); 55 | std::string getConfigFilePath(); 56 | 57 | 58 | private: 59 | /*Global Schema Value*/ 60 | FTC_SYNTHESIZE_PASS_BY_REF(std::string , _ftcUrl, FtcUrl); 61 | FTC_SYNTHESIZE_PASS_BY_REF(std::string , _ftcServer, FtcServer); 62 | FTC_SYNTHESIZE_PASS_BY_REF(int , _clipboardPort, ClipboardPort); 63 | FTC_SYNTHESIZE_PASS_BY_REF(int , _fileDownloadThreadCnt, FileDownloadThreadCnt); 64 | FTC_SYNTHESIZE_PASS_BY_REF(int , _fileUploadThreadCnt, FileUploadThreadCnt); 65 | 66 | /*User Config Value*/ 67 | FTC_SYNTHESIZE_PASS_BY_REF(std::string , _userId, UserId); 68 | }; 69 | END_FTC_CORE 70 | #endif -------------------------------------------------------------------------------- /src/src/core/model/GlobalStruct.cpp: -------------------------------------------------------------------------------- 1 | #include "GlobalStruct.h" 2 | 3 | BEGIN_FTC_CORE 4 | 5 | namespace GlobalStruct 6 | { 7 | 8 | } 9 | 10 | 11 | END_FTC_CORE -------------------------------------------------------------------------------- /src/src/core/model/GlobalStruct.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_MODEL_GLOBAL_STRUCT_H_ 2 | #define _FTC_CORE_MODEL_GLOBAL_STRUCT_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "../macro.h" 8 | 9 | BEGIN_FTC_CORE 10 | namespace GlobalStruct 11 | { 12 | typedef struct _FtcRequestApprovalInfo 13 | { 14 | std::string approval_state; 15 | std::string approval_type; 16 | std::string last_approval_type; 17 | } FtcRequestApprovalInfo; 18 | 19 | typedef struct _FtcRequestInfoFile{ 20 | std::string request_info_file_list_uid; 21 | std::string file_name; 22 | std::string file_path; 23 | std::string relative_dir; 24 | std::string server_file_name; 25 | std::string md5sum; 26 | int file_size; 27 | int download_limit_cnt; 28 | int download_cnt; 29 | 30 | _FtcRequestInfoFile() 31 | { 32 | file_size = 0; 33 | } 34 | } FtcRequestInfoFile; 35 | 36 | typedef struct _FtcRequestInfo{ 37 | std::string request_user_name; 38 | std::string request_user_id; 39 | std::string request_user_group_name; 40 | std::string request_text; 41 | std::string receive_name; 42 | 43 | std::string receive_id; 44 | std::string receive_user_group_name; 45 | } FtcRequestInfo; 46 | 47 | typedef struct _FtcNetwork 48 | { 49 | std::string direction; 50 | std::string from_network_id; 51 | std::string from_network_name; 52 | std::string network_direction_id; 53 | std::string to_name; 54 | std::string to_network_name; 55 | std::string to_network_id; 56 | } FtcNetwork; 57 | 58 | typedef struct _FtcRequest { 59 | std::vector vc_file_info; 60 | FtcRequestInfo ftc_request_info; 61 | FtcRequestApprovalInfo ftc_request_approval_info; 62 | std::string request_info_uid; 63 | std::string request_title; 64 | std::string request_user_name; 65 | std::string request_user_id; 66 | std::string request_dt; 67 | std::string firstFileName; 68 | std::string from_network_id; 69 | std::string from_network_name; 70 | std::string to_network_id; 71 | std::string to_network_name; 72 | std::string download_expire_dt; 73 | int file_cnt; 74 | int totalFileSize; 75 | bool is_read; 76 | 77 | _FtcRequest() 78 | { 79 | file_cnt = 0; 80 | totalFileSize = 0; 81 | is_read = false; 82 | } 83 | 84 | 85 | } FtcRequest; 86 | 87 | typedef struct _FtcTargetInfo 88 | { 89 | std::string userid; 90 | std::string name; 91 | std::string dept; 92 | std::string network_name; 93 | std::string network_type; 94 | std::string network_location; 95 | std::string network_id; 96 | std::string ip; 97 | } FtcTargetInfo; 98 | 99 | typedef struct _FtcUser 100 | { 101 | std::string user_id; 102 | std::string user_name; 103 | bool is_group; 104 | bool is_include_sub_group; 105 | } FtcUser; 106 | } 107 | 108 | END_FTC_CORE 109 | 110 | 111 | #endif /* _FTC_CORE_MODEL_GLOBAL_STRUCT_H_ */ -------------------------------------------------------------------------------- /src/src/core/model/GlobalVar.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include 13 | #include "GlobalVar.h" 14 | #include "../macro.h" 15 | #include "../JsonUtils.h" 16 | 17 | BEGIN_FTC_CORE 18 | 19 | static ClientConfig s_ClientConfig ; 20 | static LoginLocation s_LoginLocation ; 21 | static User s_User ; 22 | static Properties s_Properties ; 23 | static LeftMenuCount s_LeftMenuCount ; 24 | 25 | namespace GlobalVar 26 | { 27 | void init(){ 28 | s_ClientConfig.init(); 29 | } 30 | 31 | ClientConfig &getClientConfig(){ 32 | return s_ClientConfig; 33 | } 34 | 35 | const char *getFtcUrl() { 36 | return s_ClientConfig.getFtcUrl().c_str(); 37 | } 38 | 39 | const LoginLocation& getLoginLocation(){ 40 | return s_LoginLocation; 41 | } 42 | 43 | const User& getUser(){ 44 | return s_User; 45 | } 46 | 47 | const Properties& getProperties(){ 48 | return s_Properties; 49 | } 50 | 51 | const LeftMenuCount& getLeftMenuCount(){ 52 | return s_LeftMenuCount; 53 | } 54 | 55 | void dispose() { 56 | s_ClientConfig.dispose(); 57 | } 58 | 59 | } // namespace GlobalVar 60 | END_FTC_CORE 61 | -------------------------------------------------------------------------------- /src/src/core/model/GlobalVar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_MODEL_GLOBAL_VAR_H_ 13 | #define _FTC_CORE_MODEL_GLOBAL_VAR_H_ 14 | #include 15 | #include 16 | 17 | #include "ClientConfig.h" 18 | #include "ValueObject.h" 19 | #include "User.h" 20 | #include "Properties.h" 21 | 22 | 23 | BEGIN_FTC_CORE 24 | namespace GlobalVar 25 | { 26 | void init(); 27 | 28 | const char *getFtcUrl(); 29 | ClientConfig &getClientConfig(); 30 | const LoginLocation& getLoginLocation(); 31 | const User& getUser(); 32 | const Properties& getProperties(); 33 | const LeftMenuCount& getLeftMenuCount(); 34 | 35 | void dispose(); 36 | } // namespace GlobalVar 37 | 38 | END_FTC_CORE 39 | 40 | #endif /* _FTC_CORE_MODEL_GLOBAL_VAR_H_ */ -------------------------------------------------------------------------------- /src/src/core/model/PackFilePop.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_MODEL_PACKFILEPOP_H_ 2 | #define _FTC_CORE_MODEL_PACKFILEPOP_H_ 3 | 4 | #include "../macro.h" 5 | #include "ValueObject.h" 6 | #include "GlobalStruct.h" 7 | #include 8 | #include 9 | 10 | BEGIN_FTC_CORE 11 | 12 | class PackFilePop : public BaseValue 13 | { 14 | public : 15 | PackFilePop(const std::string& network_id) ; 16 | virtual ~PackFilePop(); 17 | JsonObject *getApproval(); 18 | void setApproval(JsonObject *obj) ; 19 | 20 | 21 | void putRecvNetwork(const char* network); 22 | void removeRecvNetwork(const char* network); 23 | void copyApprovalJson(JsonObject* dest); 24 | 25 | JsonObject *getApprovalData(); 26 | 27 | protected : 28 | virtual bool parseJsonNode(JsonNode* node) override; 29 | virtual bool internalClear() override ; 30 | 31 | enum NetworkPolicyCheckCode 32 | { 33 | NONE = 0, 34 | ALLOW_WEEKEND_PERIOD = 1, 35 | ALLOW_TIME_PERIOD = 2, 36 | FT_PERMIT_YN = 4, 37 | FT_PERMIT_SEND = 8 38 | }; 39 | 40 | JsonObject *getPolicySettingUserVO(const char* network); 41 | std::list getApprovalUserVO(const char* network); 42 | 43 | bool generateDefaultApproval(); 44 | bool putNetowkrApproval(JsonObject *data , const char* network); 45 | bool putNetowkrApproval(const char* network); 46 | bool removeNetworkApproval(const char* network); 47 | void setReceiveNetwork(); 48 | 49 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(bool, _is_my_exception, IsMyException); /* 결재예외 */ 50 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(bool, _is_temp_use_exception, IsTempUseException); /* 임시결재 예외 */ 51 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(bool, _is_approval_officer_yn, IsApprovalOfficerYN); /* 임원여부 */ 52 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(int, _use_apt_deny_file_size, UseAptDenyFileSize); 53 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(int, _apt_detect_file_size, AptDectectFileSize); 54 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(bool, _apt_detect_use, AptDetectUse); 55 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(int, _receive_id_sum, ReceiveIdSum); 56 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(bool, _retain_id_sum, RetainIdSum); 57 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::string, _ftc_contents, FtcContents); 58 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::list, _list_ftc_network, ListFtcNetwork); 59 | FTC_SYNTHESIZE_PASS_BY_REF(int, _dynamic_file_policy_type, DynamicFilepolicyType); 60 | FTC_SYNTHESIZE_PASS_BY_REF(int, _file_cnt_with_zip, FileCntWithZip); 61 | FTC_SYNTHESIZE(bool, _is_violate_file, IsViolateFile); 62 | FTC_SYNTHESIZE(bool, _is_private_info, IsPrivateInfo); 63 | FTC_SYNTHESIZE(bool, _is_approval_line_extension_check, IsApprovalLineExtensionCheck) 64 | private : 65 | JsonObject *_obj ; 66 | JsonObject *_obj_info; 67 | JsonObject *_obj_policy_info; 68 | JsonObject *_approval; 69 | 70 | std::set _recv_network ; 71 | std::string _network_id ; 72 | std::string _user_id ; 73 | std::string _user_name ; 74 | bool _server_approval ; 75 | }; 76 | 77 | 78 | 79 | END_FTC_CORE 80 | 81 | 82 | #endif /* _FTC_CORE_MODEL_PACKFILEPOP_H_ */ -------------------------------------------------------------------------------- /src/src/core/model/Properties.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../StringUtils.h" 3 | #include "../JsonUtils.h" 4 | #include "Properties.h" 5 | 6 | 7 | BEGIN_FTC_CORE 8 | Properties::Properties():BaseValue(){ 9 | } 10 | 11 | Properties::~Properties(){ 12 | this->clear(); 13 | } 14 | 15 | bool Properties::parseJsonNode(JsonNode *node){ 16 | bool rv = false ; 17 | JsonObject *jobj = nullptr ; 18 | JsonNode *jtmp = nullptr ; 19 | JsonArray *list = nullptr ; 20 | const char *result = nullptr ; 21 | const char *enc_key = nullptr ; 22 | std::string enc ; 23 | size_t offset = std::string::npos ; 24 | if (!node) { 25 | return rv; 26 | } 27 | 28 | jobj = JsonUtils::getObject(node); 29 | if (!jobj) { 30 | return rv ; 31 | } 32 | 33 | result = JsonUtils::getString(jobj, "result"); 34 | if (!result) { 35 | return rv ; 36 | } 37 | if (strncmp(result, "success", 7) != 0) { 38 | return rv ; 39 | } 40 | 41 | rv = true ; 42 | return rv ; 43 | } 44 | 45 | bool Properties::internalClear(){ 46 | bool rv = false ; 47 | rv = true ; 48 | return rv ; 49 | } 50 | 51 | END_FTC_CORE -------------------------------------------------------------------------------- /src/src/core/model/Properties.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_MODEL_PROPERTIES_H_ 2 | #define _FTC_CORE_MODEL_PROPERTIES_H_ 3 | #include 4 | #include 5 | #include 6 | #include "../macro.h" 7 | #include "ValueObject.h" 8 | 9 | BEGIN_FTC_CORE 10 | 11 | class Properties : public BaseValue { 12 | public : 13 | Properties(); 14 | virtual ~Properties(); 15 | protected : 16 | virtual bool parseJsonNode(JsonNode* node) override; 17 | virtual bool internalClear() override ; 18 | private : 19 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(bool, _use_clipboard, UseClipboard); 20 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(bool, _use_url_redirection, UseUrlRedirection); 21 | }; 22 | 23 | END_FTC_CORE 24 | #endif /* _FTC_CORE_MODEL_PROPERTIES_H_ */ -------------------------------------------------------------------------------- /src/src/core/model/UploadOption.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_MODEL_UPLOAD_OPTION_H_ 2 | #define _FTC_CORE_MODEL_UPLOAD_OPTION_H_ 3 | #include "GlobalStruct.h" 4 | #include "../JsonUtils.h" 5 | #include 6 | #include 7 | #include 8 | BEGIN_FTC_CORE 9 | 10 | #define JSON_KEY_APPROVAL_LEVEL "approval_level_%d_%s" 11 | #define JSON_KEY_APPROVAL_LEVEL_NAME "approval_level_name_%d_%s" 12 | #define JSON_KEY_APPROVAL_USER_ID "approval_user_id_%d_%s" 13 | #define JSON_KEY_APPROVAL_USER_NAME "approval_user_name_%d_%s_%s" 14 | #define JSON_KEY_IS_AFTER_CHECK "is_after_check_%d_%s" 15 | #define JSON_KEY_IS_AFTER_CHECK_USER "is_after_check_user_%d_%s" 16 | 17 | class UploadOption 18 | { 19 | public: 20 | UploadOption(); 21 | virtual ~UploadOption(); 22 | 23 | private: 24 | std::vector vc_network_list; 25 | std::vector vc_user_list; 26 | std::map map_approval_lines; 27 | std::string send_title; 28 | std::string send_reason; 29 | std::string privacy_info; 30 | 31 | static void parseApprovalLines (JsonObject *object, const gchar *memberName, JsonNode *memberNode, gpointer userData) ; 32 | public: 33 | void setNetworks(std::vector &vc_network_list); 34 | void addNetwork(GlobalStruct::FtcNetwork &network); 35 | int findNetworkId(const char *network_id); 36 | int findNetworkName(const char *network_name); 37 | GlobalStruct::FtcNetwork& getNetwork(unsigned int index); 38 | unsigned int getNetworkSize(); 39 | void clearNetwork(); 40 | 41 | void addUser(GlobalStruct::FtcUser &user); 42 | int findUser(const char *user_id); 43 | GlobalStruct::FtcUser& getUser(unsigned int index); 44 | unsigned int getUserSize(); 45 | void clearUser(); 46 | std::string toUserParam(); 47 | 48 | const char* getSendReason(); 49 | void setSendReason(std::string &reason); 50 | void setSendReason(const char *reason); 51 | void clearSendReason(); 52 | 53 | const char* getSendTitle(); 54 | void setSendTitle(std::string &title); 55 | void setSendTitle(const char *title); 56 | void clearSendTitle(); 57 | 58 | void setApprovalLines(std::map &approval_lines); 59 | void setApprovalLines(JsonObject *obj); 60 | const std::map& getApprovalLines(); 61 | void toApprovalJsonFormat(JsonObject *json_obj); 62 | void clearApprovalLines(); 63 | }; 64 | 65 | END_FTC_CORE 66 | 67 | 68 | 69 | 70 | #endif /* _FTC_CORE_MODEL_UPLOAD_OPTION_H_ */ -------------------------------------------------------------------------------- /src/src/core/model/User.cpp: -------------------------------------------------------------------------------- 1 | #include "../JsonUtils.h" 2 | #include "../StringUtils.h" 3 | #include "User.h" 4 | 5 | 6 | BEGIN_FTC_CORE 7 | User::User():BaseValue(), _obj(nullptr){ 8 | } 9 | User::~User(){ 10 | this->clear(); 11 | } 12 | bool User::parseJsonNode(JsonNode *node) { 13 | bool rv = false ; 14 | JsonObject *obj = nullptr ; 15 | std::string tmp_str; 16 | if (!node) return rv ; 17 | obj = JsonUtils::getObject(node); 18 | if (!obj) return rv ; 19 | this->_result = JsonUtils::getStdString(obj, RESULT_KEY); 20 | 21 | 22 | if (this->_result.compare(RESULT_SUCCESS) != 0) { 23 | return rv ; 24 | } 25 | this->_obj = obj ; 26 | 27 | this->_contact = JsonUtils::getStdString(this->_obj, "contact"); 28 | this->_userid = JsonUtils::getStdString(this->_obj, "userid"); 29 | this->_network_id = JsonUtils::getStdString(this->_obj, "network_id"); 30 | tmp_str = JsonUtils::getStdString(this->_obj, "formats_allow_list"); 31 | this->_formats_allow_list = StringUtils::splitToVector(tmp_str, ','); 32 | 33 | rv = true ; 34 | return rv ; 35 | } 36 | bool User::internalClear() { 37 | this->_obj = nullptr ; 38 | return true ; 39 | } 40 | 41 | const JsonObject *User::getJsonObject() const{ 42 | return this->_obj; 43 | } 44 | END_FTC_CORE -------------------------------------------------------------------------------- /src/src/core/model/User.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_MODEL_USER_H_ 2 | #define _FTC_CORE_MODEL_USER_H_ 3 | #include "../macro.h" 4 | #include "ValueObject.h" 5 | 6 | BEGIN_FTC_CORE 7 | 8 | class User : public BaseValue{ 9 | public : 10 | User() ; 11 | virtual ~User(); 12 | const JsonObject *getJsonObject() const ; 13 | protected : 14 | virtual bool parseJsonNode(JsonNode *node) override ; 15 | virtual bool internalClear() override ; 16 | 17 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::string , _result, Result); 18 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::string , _contact, Contact); 19 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::string , _userid, UserId); 20 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::string , _network_id, NetworkId); 21 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::vector , _formats_allow_list, FormatsAllowList); 22 | private: 23 | JsonObject *_obj ; 24 | }; 25 | END_FTC_CORE 26 | 27 | 28 | #endif /* _FTC_CORE_MODEL_USER_H_ */ 29 | -------------------------------------------------------------------------------- /src/src/core/model/ValueObject.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include "../JsonUtils.h" 13 | #include "../StringUtils.h" 14 | #include "ValueObject.h" 15 | 16 | 17 | BEGIN_FTC_CORE 18 | 19 | static std::string s_empty = ""; 20 | 21 | const std::string& getEmptyString(){ 22 | return s_empty; 23 | } 24 | 25 | BaseValue::BaseValue():_node(nullptr){ 26 | 27 | } 28 | 29 | BaseValue::BaseValue(const BaseValue &b){ 30 | this->_node = b._node ; 31 | if (this->_node){ 32 | json_node_ref(this->_node); 33 | } 34 | } 35 | 36 | BaseValue::~BaseValue(){ 37 | if (this->_node){ 38 | json_node_unref(this->_node); 39 | this->_node = nullptr ; 40 | } 41 | } 42 | 43 | bool BaseValue::setJosnNode(JsonNode *node){ 44 | bool rv = false ; 45 | if (!node) return rv ; 46 | this->clear(); 47 | if (this->parseJsonNode(node)){ 48 | this->_node = node ; 49 | json_node_ref(this->_node); 50 | rv = true ; 51 | } 52 | return rv ; 53 | } 54 | 55 | JsonNode* BaseValue::getJsonNode() const { 56 | return this->_node ; 57 | } 58 | 59 | void BaseValue::clear(){ 60 | this->internalClear(); 61 | if (this->_node){ 62 | json_node_unref(this->_node); 63 | this->_node = nullptr ; 64 | } 65 | } 66 | 67 | /** 68 | * Begin Login Location 69 | **/ 70 | LoginLocation::LoginLocation():BaseValue(){ 71 | } 72 | LoginLocation::~LoginLocation(){ 73 | this->clear(); 74 | } 75 | bool LoginLocation::parseJsonNode(JsonNode *node) { 76 | bool rv = false ; 77 | JsonObject *jobj = NULL; 78 | if (!node) return rv ; 79 | 80 | jobj = JsonUtils::getObject(node); 81 | if (!jobj) { 82 | return rv ; 83 | } 84 | 85 | if (JsonUtils::getStdString(node, RESULT_KEY).compare(RESULT_SUCCESS) != 0) { 86 | this->_error_msg = JsonUtils::getStdString(node, "message"); 87 | return rv ; 88 | } 89 | 90 | this->_location = JsonUtils::getStdString(node, "location"); 91 | this->_name = JsonUtils::getStdString(node, "name"); 92 | this->_network_id = JsonUtils::getStdString(node, "network_id"); 93 | 94 | if (this->_name.empty() || this->_location.empty()) return rv ; 95 | 96 | rv = true ; 97 | return rv ; 98 | } 99 | bool LoginLocation::internalClear() { 100 | this->_location.clear(); 101 | this->_name.clear(); 102 | this->_network_id.clear(); 103 | this->_error_msg.clear(); 104 | return true ; 105 | } 106 | /** 107 | * End Login Location 108 | **/ 109 | 110 | 111 | /** 112 | * Begin LeftMenuCount 113 | **/ 114 | LeftMenuCount::LeftMenuCount():BaseValue(){ 115 | 116 | } 117 | 118 | LeftMenuCount::~LeftMenuCount(){ 119 | this->clear(); 120 | } 121 | 122 | bool LeftMenuCount::parseJsonNode(JsonNode *node) { 123 | bool rv = false ; 124 | JsonObject *obj = nullptr ; 125 | JsonArray *arr = nullptr; 126 | int length = 0; 127 | const char *str = nullptr ; 128 | obj = JsonUtils::getObject(node); 129 | if (!obj) return rv ; 130 | 131 | if (JsonUtils::getStdString(obj, "result") != "success") { 132 | return rv; 133 | } 134 | 135 | this->_receiveCnt = JsonUtils::getInt(obj, "receiveCnt", -1); 136 | this->_sendCnt = JsonUtils::getInt(obj, "sendCnt", -1); 137 | 138 | rv = true ; 139 | return rv ; 140 | } 141 | 142 | bool LeftMenuCount::internalClear() { 143 | this->_receiveCnt = -1; 144 | this->_sendCnt = -1; 145 | 146 | } 147 | 148 | END_FTC_CORE 149 | -------------------------------------------------------------------------------- /src/src/core/model/ValueObject.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_CORE_MODEL_VALUE_OBJECT_H_ 13 | #define _FTC_CORE_MODEL_VALUE_OBJECT_H_ 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "../macro.h" 19 | #define RESULT_KEY "result" 20 | #define RESULT_SUCCESS "success" 21 | 22 | BEGIN_FTC_CORE 23 | 24 | 25 | const std::string& getEmptyString(); 26 | 27 | class BaseValue{ 28 | protected: 29 | BaseValue(); 30 | BaseValue(const BaseValue &b); 31 | virtual ~BaseValue(); 32 | virtual bool parseJsonNode(JsonNode *node) = 0 ; 33 | virtual bool internalClear() = 0 ; 34 | public: 35 | bool setJosnNode(JsonNode *node); 36 | JsonNode* getJsonNode() const; 37 | void clear() ; 38 | bool isValid() const { return this->_node != nullptr ; } 39 | 40 | protected: 41 | JsonNode *_node ; 42 | }; 43 | 44 | class LoginLocation : public BaseValue{ 45 | public: 46 | LoginLocation(); 47 | virtual ~LoginLocation(); 48 | const JsonObject* getNetwork() const ; 49 | 50 | protected : 51 | virtual bool parseJsonNode(JsonNode *node) override ; 52 | virtual bool internalClear() override ; 53 | 54 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::string , _location, Location); 55 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::string , _name, Name); 56 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::string , _network_id, NetworkId); 57 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(std::string , _error_msg, ErrorMsg); 58 | private : 59 | }; 60 | 61 | class LeftMenuCount : public BaseValue{ 62 | public : 63 | LeftMenuCount(); 64 | virtual ~LeftMenuCount(); 65 | 66 | bool update(int day = 30); 67 | protected : 68 | virtual bool parseJsonNode(JsonNode *node) override ; 69 | virtual bool internalClear() override ; 70 | 71 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(int, _receiveCnt, ReceiveCnt); 72 | FTC_SYNTHESIZE_READONLY_PASS_BY_REF(int, _sendCnt, SendCnt); 73 | }; 74 | 75 | 76 | 77 | END_FTC_CORE 78 | #endif /* _FTC_CORE_MODEL_VALUE_OBJECT_H_ */ -------------------------------------------------------------------------------- /src/src/core/sys_utils.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | #include "sys_utils.h" 22 | #include "NetUtils.h" 23 | #include "Logger.h" 24 | 25 | static std::string s_ips; 26 | static std::string s_ip_macs; 27 | 28 | static pthread_t s_main_thread = 0; 29 | 30 | static bool initIpMac() 31 | { 32 | bool rv = false; 33 | bool first = true; 34 | 35 | if (!s_ips.empty() && !s_ip_macs.empty()) 36 | { 37 | rv = true; 38 | return rv; 39 | } 40 | 41 | std::list list = Ftc::Core::NetUtils::getNetInfo(); 42 | 43 | if (list.size() == 0) 44 | return rv; 45 | 46 | for (auto &ele : list) 47 | { 48 | if (!first) 49 | { 50 | s_ips.append(","); 51 | s_ip_macs.append(","); 52 | } 53 | s_ips.append(ele.inetAddr); 54 | s_ip_macs.append(ele.inetAddr); 55 | s_ip_macs.append("_"); 56 | s_ip_macs.append(ele.macAddr); 57 | first = false ; 58 | } 59 | 60 | #ifdef FTC_DEBUG 61 | FTC_LOG_DEBUG("IP ADDRES = %s", s_ips.c_str()); 62 | FTC_LOG_DEBUG("IP MAC ALL = %s", s_ip_macs.c_str()); 63 | #endif 64 | 65 | rv = true; 66 | return rv; 67 | } 68 | 69 | std::string getIp() 70 | { 71 | initIpMac(); 72 | return s_ips; 73 | } 74 | std::string getIpAndMac() 75 | { 76 | initIpMac(); 77 | return s_ip_macs; 78 | } 79 | 80 | 81 | int getPID() 82 | { 83 | return getpid(); 84 | } 85 | 86 | unsigned long int getThreadId() 87 | { 88 | return pthread_self(); 89 | } 90 | 91 | void ftc_system_init() 92 | { 93 | s_main_thread = pthread_self(); 94 | } 95 | bool ftc_is_main_thread() 96 | { 97 | return s_main_thread == pthread_self(); 98 | } 99 | 100 | int 101 | ftc_run_xdg_open(const std::string ¶m) 102 | { 103 | int rv = 0; 104 | std::stringstream ss; 105 | ss << "xdg-open \""; 106 | ss << param; 107 | ss << "\""; 108 | 109 | rv = system(ss.str().c_str()); 110 | if (rv != 0) { 111 | FTC_LOG("XDG OPEN FAIL : %s", param.c_str()); 112 | } 113 | 114 | return rv; 115 | } 116 | 117 | 118 | int 119 | ftc_open_default_uri(const std::string ¶m) 120 | { 121 | GError *error = NULL; 122 | 123 | if (g_app_info_launch_default_for_uri(param.c_str(), NULL, &error)) { 124 | return 0; 125 | } 126 | 127 | FTC_LOG("OPEN URI FAIL : %s", param.c_str()); 128 | g_error_free(error); 129 | 130 | return 1; 131 | } 132 | 133 | int 134 | ftc_open_url(const std::string &url) 135 | { 136 | std::string param = url; 137 | if ((param.find("http://") == std::string::npos) && (param.find("https://") == std::string::npos)) { 138 | param = param.insert(0, "http://"); 139 | } 140 | 141 | return ftc_open_default_uri(param); 142 | } 143 | 144 | int 145 | ftc_open_directory(const std::string &dir) 146 | { 147 | std::string param = dir; 148 | if (param.find("file://") == std::string::npos) { 149 | param = param.insert(0, "file://"); 150 | } 151 | 152 | return ftc_open_default_uri(param); 153 | } -------------------------------------------------------------------------------- /src/src/core/sys_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_SYS_UTILS_H_ 13 | #define _FTC_SYS_UTILS_H_ 14 | 15 | #include 16 | #include 17 | 18 | std::string getIp(); 19 | std::string getIpAndMac(); 20 | int getPID(); 21 | unsigned long int getThreadId(); 22 | 23 | 24 | void ftc_system_init(); 25 | bool ftc_is_main_thread(); 26 | int ftc_run_xdg_open(const std::string ¶m); 27 | int ftc_open_default_uri(const std::string ¶m); 28 | int ftc_open_url(const std::string &url); 29 | int ftc_open_directory(const std::string &dir); 30 | 31 | 32 | #endif /* _FTC_SYS_UTILS_H_ */ -------------------------------------------------------------------------------- /src/src/core/transfer/Download.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_TRANSFER_DOWNLOAD_H_ 2 | #define _FTC_CORE_TRANSFER_DOWNLOAD_H_ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "DownloadRequest.h" 12 | #include "../macro.h" 13 | #include "../EventManager.h" 14 | #include "../JsonUtils.h" 15 | 16 | BEGIN_FTC_CORE namespace Transfer{ 17 | 18 | 19 | enum DownloadStatus { 20 | DOWNLOAD_CANCEL = 0, 21 | DOWNLOADING, 22 | DOWNLOAD_COMPLETE, 23 | DOWNLOAD_NONE 24 | }; 25 | 26 | typedef struct _DownloadResultParam { 27 | DownloadStatus status; 28 | JsonNode *node; 29 | gpointer user_data; 30 | } DownloadResultParam; 31 | 32 | class Download{ 33 | private: 34 | Download() ; 35 | public: 36 | static Download *getInstance(); 37 | static void destroyInstance(); 38 | virtual ~Download(); 39 | 40 | bool pushRequest(std::shared_ptr &request); 41 | 42 | bool downloadFile(std::shared_ptr &file); 43 | 44 | const std::shared_ptr getDownloadList(const std::string &request_info_uid, const std::string &local_ip); 45 | const std::shared_ptr getDownloadListParser(JsonNode *node, const std::string &arr_name); 46 | 47 | void cancel(); 48 | bool cancel(std::string &request_info_uid); 49 | bool isWorking(); 50 | private: 51 | void stop(); 52 | 53 | bool pushFiles(const std::list > &files); 54 | bool pushCheckFile(std::shared_ptr &file); 55 | 56 | void downloadRequestThreadFunc(); 57 | void downloadFileThreadFunc(); 58 | void downloadCheckThreadFunc(); 59 | 60 | bool downloadRequest(std::shared_ptr &request); 61 | 62 | JsonNode* getNodeProgressInfo(std::shared_ptr &file); 63 | JsonNode* getNodeCompleteInfo(std::shared_ptr &request); 64 | 65 | void sendResultEvent(DownloadStatus status, JsonNode *result_root_node, const char *event_name, gpointer user_data); 66 | 67 | private: 68 | static Download *s_instance ; 69 | static std::atomic s_stop ; 70 | static std::atomic s_cancel ; 71 | static std::atomic s_downloading ; 72 | 73 | std::thread _downloadRequestThread ; 74 | std::thread _downloadFileThread ; 75 | std::thread _downloadCheckThread ; 76 | 77 | std::list > _files ; 78 | std::list > _requests ; 79 | std::list > _checks ; 80 | 81 | std::mutex _downloadFileMutex ; 82 | std::condition_variable _downloadFileCond ; 83 | 84 | std::mutex _downloadRequestMutex ; 85 | std::condition_variable _downloadRequestCond ; 86 | 87 | std::mutex _downloadCheckMutex ; 88 | std::condition_variable _downloadCheckCond ; 89 | 90 | std::mutex _cancelMutex; 91 | std::condition_variable _cancelCond ; 92 | }; 93 | } 94 | 95 | END_FTC_CORE 96 | #endif -------------------------------------------------------------------------------- /src/src/core/transfer/DownloadRequest.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_TRANSFER_DOWNLOAD_REQUEST_H_ 2 | #define _FTC_CORE_TRANSFER_DOWNLOAD_REQUEST_H_ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "../macro.h" 10 | #include "../FileInfo.h" 11 | BEGIN_FTC_CORE namespace Transfer{ 12 | 13 | class DownloadRequest ; 14 | 15 | class DownloadFile{ 16 | public: 17 | DownloadFile(); 18 | DownloadFile(std::shared_ptr request, std::string &request_info_file_list_uid, std::string &filename, std::string &from_network_id, std::string &to_network_id, std::string &list_type); 19 | virtual ~DownloadFile(); 20 | 21 | const std::string& getRequestInfoFileListUid() const; 22 | const std::string& getFilename() const; 23 | void setFilename(const std::string &filename); 24 | const std::string& getRelativeDir() const; 25 | void setRelativeDir(const std::string &relative_dir); 26 | 27 | DownloadRequest *getRequest() const ; 28 | std::shared_ptr &getRequestPtr() ; 29 | const std::string& getFromNetworkId() const; 30 | const std::string& getToNetworkId() const; 31 | const std::string& getListType() const; 32 | 33 | const std::string& getErrorMsg() const; 34 | void setErrorMsg(const std::string &error_msg); 35 | 36 | int getProgress(); 37 | void setProgress(int progress); 38 | 39 | int getLength(); 40 | void setLength(int length); 41 | 42 | void setCancel(); 43 | bool isCancel() const; 44 | 45 | void setCompleted(); 46 | bool isCompleted() const ; 47 | 48 | void setSuccess(); 49 | bool isSuccess() const ; 50 | 51 | bool isEquals(const DownloadFile &other); 52 | private: 53 | std::string _request_info_file_list_uid; 54 | std::string _filename; 55 | std::string _relative_dir; 56 | std::string _from_network_id; 57 | std::string _to_network_id; 58 | std::string _list_type; 59 | 60 | std::string _error_msg; 61 | 62 | std::shared_ptr _request; 63 | std::atomic _progress; 64 | std::atomic _complete; 65 | std::atomic _success; 66 | std::atomic _cancel; 67 | 68 | int _length; 69 | 70 | std::mutex _lock ; 71 | }; 72 | 73 | class DownloadRequest{ 74 | public: 75 | DownloadRequest(); 76 | DownloadRequest(std::string &request_info_uid, std::string &directory); 77 | DownloadRequest(std::string &request_info_uid, std::string &directory, std::list> files); 78 | 79 | virtual ~DownloadRequest(); 80 | 81 | void pushDownloadFile(std::shared_ptr &file); 82 | 83 | const std::string& getRequestInfoUid() const; 84 | const std::string& getDirectory() const; 85 | const std::list> &getDownlaodFiles() const; 86 | const std::string& getEventName() const; 87 | void* getUserData() const; 88 | 89 | void setRequestInfoUid(const std::string &request_info_uid); 90 | void setDirectory(const std::string &directory); 91 | void setEvent(const char *event_name, void *user_data); 92 | 93 | bool isDownloadCompleted(); 94 | bool clearFiles(); 95 | bool clearFile(const Ftc::Core::Transfer::DownloadFile *down_file); 96 | 97 | int getDownloadFilesCount() const; 98 | int getCompleteDownloadCount() const; 99 | 100 | bool setCompleteDownloadFile(std::shared_ptr &file); 101 | 102 | bool isDownloadDone(); 103 | 104 | private: 105 | void wakeUp(); 106 | 107 | private: 108 | std::string _request_info_uid; 109 | std::string _directory; 110 | std::string _event_name; 111 | void *_user_data; 112 | 113 | std::list> _files ; 114 | 115 | bool _downloadComplete ; 116 | int _completeCount ; 117 | 118 | std::mutex _lock ; 119 | std::condition_variable _cond ; 120 | }; 121 | } 122 | END_FTC_CORE 123 | #endif -------------------------------------------------------------------------------- /src/src/core/transfer/Upload.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_TRANSFER_UPLOAD_H_ 2 | #define _FTC_CORE_TRANSFER_UPLOAD_H_ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "UploadFile.h" 11 | #include "../macro.h" 12 | #include "../EventManager.h" 13 | #include "../JsonUtils.h" 14 | 15 | BEGIN_FTC_CORE namespace Transfer{ 16 | 17 | enum UploadStatus { 18 | UPLOAD_FAIL = 0, 19 | UPLOADING, 20 | UPLOADED, 21 | UPLOAD_CHECKING, 22 | UPLOAD_COMPLETE, 23 | UPLOAD_NONE 24 | }; 25 | 26 | typedef struct _UploadResultParam { 27 | UploadStatus status; 28 | JsonNode *node; 29 | gpointer user_data; 30 | } UploadResultParam; 31 | 32 | class Upload{ 33 | private: 34 | Upload() ; 35 | public: 36 | static Upload *getInstance(); 37 | static void destroyInstance(); 38 | virtual ~Upload(); 39 | 40 | bool pushFile(const FileInfo & file, std::list &networks); 41 | bool pushFiles(const std::list& files, std::list &networks); 42 | 43 | void setResultEvent(const char *eventName, void *userData); 44 | void cancel(); 45 | bool isWorking(); 46 | bool deleteUploadedFile(std::list uploadedFilesList); 47 | 48 | static long long getFileContent(const char *fileName, long long offset , long long length , unsigned char **content); 49 | private: 50 | void stop(); 51 | 52 | 53 | void uploadFilePartThreadFunc(); 54 | void uploadThreadFunc(); 55 | void uploadCheckThreadFunc(); 56 | 57 | bool pushFileParts(const std::list > &parts); 58 | bool uploadFilePart(std::shared_ptr &part); 59 | bool uploadFile(std::shared_ptr &file); 60 | bool uploadCheckBefore(std::list> &uncheckFiles); 61 | bool uploadCheck(std::list> &uncheckFiles); 62 | bool uploadCheckAfter(std::vector> &checkingFiles); 63 | 64 | static void uploadCheckResultEvent(Event *evt); 65 | std::shared_ptr getFileFromFUID(std::vector> &files, std::string &compareFuid); 66 | bool uploadCheckResultParse(JsonNode *element, JsonObject *result_obj); 67 | 68 | JsonNode* getProgressResultNode(const char *filepath, int progress); 69 | JsonNode* getUploadFailResultNode(const char *msg); 70 | void sendResultEvent(UploadStatus status, JsonNode *result_root_node); 71 | 72 | bool deleteUploadedFile(std::shared_ptr deleteFile); 73 | bool deleteUploadedFile(std::list> &deleteFiles); 74 | bool deleteUploadedFile(std::vector> &deleteFiles); 75 | private: 76 | static Upload *s_instance ; 77 | static volatile bool s_stop ; 78 | static bool s_cancel ; 79 | static bool s_uploading ; 80 | 81 | std::string _eventName; 82 | void *_userData; 83 | 84 | std::thread _uploadThread ; 85 | std::thread _uploadCheckThread ; 86 | std::list _partSenderPool ; 87 | std::list> _fileParts ; 88 | std::list > _files ; 89 | std::list > _checkFiles; 90 | std::vector > _checkingFiles; 91 | 92 | std::mutex _uploadMutex ; 93 | std::condition_variable _uploadCond ; 94 | 95 | std::mutex _partMutex ; 96 | std::condition_variable _partCond ; 97 | 98 | std::mutex _uploadCheckMutex ; 99 | std::condition_variable _uploadCheckCond ; 100 | 101 | std::mutex _cancelMutex; 102 | std::condition_variable _cancelCond ; 103 | }; 104 | } 105 | END_FTC_CORE 106 | #endif -------------------------------------------------------------------------------- /src/src/core/transfer/UploadFile.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_CORE_TRANSFER_UPLOAD_FILE_H_ 2 | #define _FTC_CORE_TRANSFER_UPLOAD_FILE_H_ 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "../macro.h" 10 | #include "../FileInfo.h" 11 | BEGIN_FTC_CORE namespace Transfer{ 12 | 13 | class UploadFile ; 14 | 15 | class UploadFilePart{ 16 | public: 17 | UploadFilePart(); 18 | UploadFilePart(std::shared_ptr file, long long offset , long long length , long long fileLength); 19 | virtual ~UploadFilePart(); 20 | FTC_SYNTHESIZE_READONLY(long long , _fileLength, FileLength) 21 | FTC_SYNTHESIZE_READONLY(long long , _offset , Offset) 22 | FTC_SYNTHESIZE_READONLY(long long , _length , Length) 23 | UploadFile *getFile() const ; 24 | std::shared_ptr &getFilePtr() ; 25 | void setCompleted(); 26 | bool isCompleted() const ; 27 | bool isEquals(const UploadFilePart &other); 28 | private: 29 | std::shared_ptr _file; 30 | bool _complete; 31 | }; 32 | 33 | class UploadFile{ 34 | public: 35 | UploadFile(const FileInfo& info, std::list &networks); 36 | virtual ~UploadFile(); 37 | const FileInfo &getFileInfo() const ; 38 | const std::string & getServerFileName() const ; 39 | const std::string & getServerFileUid() const; 40 | void setServerFileName(const std::string &name); 41 | void setServerFileUid(const std::string &uid); 42 | const std::list> &getFileParts() const; 43 | bool isUploadCompleted(); 44 | bool isCheckCompleted(); 45 | bool clearFilePart(); 46 | 47 | int getCompleteFilePartCount() const; 48 | bool setCompleteFilePart(std::shared_ptr &filePart); 49 | void setFilePartSize(std::shared_ptr file , long long partSize); 50 | void setCheckComplete(); 51 | 52 | bool isUploadDone(); 53 | 54 | std::string toNetworkParam(); 55 | std::string toFileParam(); 56 | 57 | private: 58 | void wakeUp(); 59 | 60 | private: 61 | FileInfo _fileInfo ; 62 | 63 | bool _uploadComplete ; 64 | bool _checkComplete ; 65 | std::string _msg; 66 | 67 | std::string _serverFileName ; 68 | std::string _serverFileUid; 69 | std::list _networks; 70 | std::list> _parts ; 71 | int _completeCount ; 72 | std::mutex _lock ; 73 | std::condition_variable _cond ; 74 | }; 75 | 76 | 77 | } 78 | END_FTC_CORE 79 | #endif -------------------------------------------------------------------------------- /src/src/core/urlencode.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include "urlencode.h" 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | using namespace std; 19 | 20 | 21 | std::string url_encode(const std::string &value) { 22 | ostringstream escaped; 23 | escaped.fill('0'); 24 | escaped << hex; 25 | 26 | for (std::string::const_iterator i = value.begin(), n = value.end(); i != n; ++i) { 27 | std::string::value_type c = (*i); 28 | 29 | // Keep alphanumeric and other accepted characters intact 30 | if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') { 31 | escaped << c; 32 | continue; 33 | } 34 | 35 | // Any other characters are percent-encoded 36 | escaped << uppercase; 37 | escaped << '%' << setw(2) << int((unsigned char) c); 38 | escaped << nouppercase; 39 | } 40 | 41 | return escaped.str(); 42 | } 43 | 44 | std::string url_decode(std::string &src) { 45 | std::string ret; 46 | size_t length = src.length(), i; 47 | char ch, hi, low; 48 | for (i = 0; i < length; i++) { 49 | 50 | if (src[i] == '%' && i < length - 2 && isxdigit(src[i + 1]) && isxdigit(src[i + 2])) { 51 | 52 | hi = src[i + 1]; 53 | low = src[i + 2]; 54 | 55 | hi = hi <= '9' ? hi - '0' : hi <= 'Z' ? hi - 'A' + 10 : hi - 'a' + 10; 56 | low = low <= '9' ? low - '0' : low <= 'Z' ? low - 'A' + 10 : low - 'a' + 10; 57 | 58 | ch = (hi << 4) + low; 59 | ret += ch; 60 | i += 2; 61 | } else if(src[i] == '+') { 62 | ret += ' '; 63 | } else { 64 | ret += src[i]; 65 | } 66 | } 67 | 68 | return ret; 69 | } 70 | -------------------------------------------------------------------------------- /src/src/core/urlencode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_URL_ENCODE_H_ 13 | #define _FTC_URL_ENCODE_H_ 14 | 15 | #include 16 | 17 | std::string url_encode(const std::string &value); 18 | 19 | std::string url_decode(std::string &src); 20 | 21 | #endif -------------------------------------------------------------------------------- /src/src/dbus/ftcappdbus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_APP_DBUS_H_ 13 | #define _FTC_APP_DBUS_H_ 14 | #include "playback.h" 15 | #define FTC_APP_BUS_NAME "org.hunesion.app.bus" 16 | #define FTC_APP_BUS_OBJ_NAME "/org/hunesion/app/playback" 17 | #endif -------------------------------------------------------------------------------- /src/src/dbus/playback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | 13 | #include 14 | #include "ui/ftcapplication.h" 15 | 16 | 17 | int main(int argc , char **argv){ 18 | int rv = 0 ; 19 | 20 | FtcApplication *app = NULL ; 21 | app = ftc_application_new(); 22 | if (app == NULL) return rv ; 23 | rv = g_application_run(G_APPLICATION (app), argc, argv); 24 | g_object_unref(app); 25 | return rv ; 26 | } -------------------------------------------------------------------------------- /src/src/request/libhune_request.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunesion/ossFileTransferClient/34d046479307a9b6ce490896a095261749411375/src/src/request/libhune_request.a -------------------------------------------------------------------------------- /src/src/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.8) 2 | 3 | 4 | add_library(hune_ui 5 | FtcEventCallback.cpp 6 | ftcuicommon.cpp 7 | ftcapplication.cpp 8 | ftcmainwindow.cpp 9 | ftcloginpage.cpp 10 | ftchomepage.cpp 11 | ftchomeheaderrecvbox.cpp 12 | ftchomeheadersendbox.cpp 13 | ftchomeheadersendhistorybox.cpp 14 | ftchomedndsubpage.cpp 15 | ftchomerecvlistsubpage.cpp 16 | ftchomerecvlistrow.cpp 17 | ftchomesendhistorysubpage.cpp 18 | ftchomesendhistoryrow.cpp 19 | ftchomesendlistsubpage.cpp 20 | ftchomesendlistrow.cpp 21 | ftcdetailrecvpage.cpp 22 | ftcdetailrecvrequestinfosubpage.cpp 23 | ftcdetailrecvfilelistsubpage.cpp 24 | ftcdetailrecvfilelistrow.cpp 25 | ftcdetailsendhistoryfilelistrow.cpp 26 | ftcdetailsendhistoryfilelistsubpage.cpp 27 | ftcdetailsendhistorypage.cpp 28 | ftcdetailsendhistoryrequestinfosubpage.cpp 29 | ftcdetailsendpage.cpp 30 | ../dbus/playback.c 31 | ../webkit/ftcwebkit.cpp 32 | ../webkit/ftcdbusserver.cpp 33 | ) 34 | 35 | TARGET_LINK_LIBRARIES(hune_ui ${GTK3_LIBRARIES} ${WEBKIT_LIBRARIES} ${OPENSSL_LIBRARIES} hune_core json-glib-1.0) -------------------------------------------------------------------------------- /src/src/ui/Event.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_EVENT_H_ 2 | #define _FTC_UI_EVENT_H_ 3 | 4 | /////////////// STACK EVENT /////////////// 5 | #define FTC_UI_UPDATE_MAIN_STACK_EVENT "Ftc::Ui::UpdateMainStack" 6 | 7 | #define FTC_UI_UPDATE_HOME_STACK_EVENT "Ftc::Ui::UpdateHomeStack" 8 | 9 | #define FTC_UI_UPDATE_DETAIL_RECV_STACK_EVENT "Ftc::Ui::UpdateDetailRecvStack" 10 | 11 | #define FTC_UI_APPLICATION_QUIT "Ftc::Ui::AppicationQuit" 12 | 13 | #define FTC_UI_SEND_LIST_ADD_FILE "Ftc::Ui::SendListAddFile" 14 | 15 | #define FTC_UI_SEND_HISTORY_REFRESH "Ftc::Ui::SendHistoryRefresh" 16 | 17 | #define FTC_UI_SHOW_LAST_RECV_REQUEST "Ftc::Ui::ShowLastRecvRequest" 18 | 19 | #define FTC_UI_RECV_DOWNLOAD_ALL "Ftc::Ui::RecvDownloadAll" 20 | 21 | #define FTC_UI_RECV_REQUEST_NEW_COUNT "Ftc::Ui::RecvRequestNewCount" 22 | 23 | #define FTC_UI_SEND_HISTORY_NEW_COUNT "Ftc::Ui::SendHistoryNewCount" 24 | 25 | #define FTC_UI_SELECT_CLIPBOARD_TARGET "Ftc::Ui::SelectClipboardTarget" 26 | 27 | #define FTC_UI_SEND_URL_REDIRECTION "Ftc::Ui::SendUrlRedirection" 28 | 29 | #define FTC_UI_SELECT_RECEIVE_USER "Ftc::Ui::SelectReceiveUser" 30 | 31 | #define FTC_UI_SELECT_INIT_PACK_FILE_POP_CONFIG "Ftc::Ui::InitPackFilePopConfig" 32 | 33 | #endif /* _FTC_UI_EVENT_H_ */ 34 | -------------------------------------------------------------------------------- /src/src/ui/FtcEventCallback.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "FtcEventCallback.h" 6 | #include "../core/core.h" 7 | 8 | 9 | class EventCustom ; 10 | 11 | static bool event_g_idle_stop = false ; 12 | static std::list _events ; 13 | static std::mutex _lock ; 14 | 15 | class EventCustom{ 16 | public: 17 | EventCustom(const char *event_name , void *user_data, void (*release)(void*)): 18 | eventName(event_name), 19 | userData(user_data), 20 | release(release) 21 | { 22 | 23 | } 24 | virtual ~EventCustom(){ 25 | if (userData && release){ 26 | release(userData); 27 | } 28 | } 29 | 30 | std::string eventName ; 31 | void *userData ; 32 | void (*release)(void*) ; 33 | }; 34 | 35 | static bool push_event(EventCustom *evt){ 36 | bool rv = false ; 37 | std::lock_guard lk(_lock); 38 | if (!evt) return rv ; 39 | if (event_g_idle_stop) return rv ; 40 | _events.push_back(evt); 41 | rv = true ; 42 | return rv ; 43 | } 44 | 45 | static EventCustom *pop_event(){ 46 | EventCustom *rv = nullptr ; 47 | std::lock_guard lk(_lock); 48 | if (_events.size() == 0){ 49 | return rv ; 50 | } 51 | rv = _events.front(); 52 | _events.pop_front(); 53 | return rv ; 54 | } 55 | 56 | static void clear(){ 57 | std::lock_guard lk(_lock); 58 | _events.clear(); 59 | } 60 | 61 | 62 | static gboolean event_source_func(gpointer data){ 63 | gboolean rv = false ; 64 | EventCustom *evt = nullptr ; 65 | int loopCount = 0 ; 66 | Ftc::Core::EventManager *manager = Ftc::Core::EventManager::getInstance(); 67 | if (manager == nullptr) return rv; 68 | 69 | do { 70 | if (loopCount > 3) break ; 71 | 72 | evt = pop_event(); 73 | if (!evt) break ; 74 | 75 | manager->dispatchEvent(evt->eventName.c_str(), evt->userData); 76 | 77 | if (evt){ 78 | delete evt ; 79 | evt = nullptr ; 80 | } 81 | ++loopCount ; 82 | 83 | } while(true); 84 | 85 | return rv ; 86 | } 87 | 88 | 89 | static bool evnet_manager_callback(const char *event_name , void *user_data, void (*release)(void*)){ 90 | bool rv = false ; 91 | EventCustom *evt = nullptr ; 92 | if (event_g_idle_stop) return rv; 93 | 94 | if (!event_name) return rv; 95 | evt = new (std::nothrow) EventCustom(event_name , user_data , release); 96 | if (evt == nullptr) return rv ; 97 | 98 | if (push_event(evt)){ 99 | g_main_context_invoke(NULL, event_source_func, NULL); 100 | rv = true ; 101 | } 102 | 103 | return rv ; 104 | } 105 | 106 | bool ftc_event_callback_init(){ 107 | bool rv = false ; 108 | Ftc::Core::EventManager *event_mgr = Ftc::Core::EventManager::getInstance(); 109 | if (!event_mgr) return rv ; 110 | event_mgr->setAsyncEventCallback(evnet_manager_callback); 111 | rv = true ; 112 | return rv ; 113 | } 114 | 115 | bool ftc_event_callback_dispose(){ 116 | bool rv = false; 117 | if (event_g_idle_stop) return rv ; 118 | event_g_idle_stop = true ; 119 | rv = true ; 120 | return rv ; 121 | } -------------------------------------------------------------------------------- /src/src/ui/FtcEventCallback.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_EVENT_CALLBACK_H_ 2 | #define _FTC_UI_EVENT_CALLBACK_H_ 3 | bool ftc_event_callback_init(); 4 | bool ftc_event_callback_dispose(); 5 | #endif 6 | -------------------------------------------------------------------------------- /src/src/ui/ftcapplication.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | 13 | #ifndef _FTC_UI_APPLICATION_H_ 14 | #define _FTC_UI_APPLICATION_H_ 15 | #include "ftcuicommon.h" 16 | 17 | #define FTC_TYPE_APPLICATION (ftc_application_get_type ()) 18 | G_DECLARE_FINAL_TYPE (FtcApplication, ftc_application, FTC, APPLICATION, GtkApplication) 19 | 20 | 21 | FtcApplication *ftc_application_new (void); 22 | 23 | 24 | #endif /* _FTC_UI_APPLICATION_H_ */ 25 | -------------------------------------------------------------------------------- /src/src/ui/ftcdetailrecvfilelistrow.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_DETAIL_RECV_FILE_LIST_ROW_H 2 | #define _FTC_UI_DETAIL_RECV_FILE_LIST_ROW_H 3 | #include "ftcuicommon.h" 4 | 5 | 6 | #define FTC_DETAIL_RECV_FILE_LIST_ROW_TYPE (ftc_detail_recv_file_list_row_get_type ()) 7 | G_DECLARE_FINAL_TYPE (FtcDetailRecvFileListRow, ftc_detail_recv_file_list_row, FTC, DETAIL_RECV_FILE_LIST_ROW, GtkBox) 8 | 9 | 10 | FtcDetailRecvFileListRow* ftc_detail_recv_file_list_row_new(); 11 | 12 | void ftc_detail_recv_file_list_row_set_data(FtcDetailRecvFileListRow *row, Ftc::Core::GlobalStruct::FtcRequestInfoFile &file_info, bool is_expired_date); 13 | 14 | const char* ftc_detail_recv_file_list_row_get_file_uid(FtcDetailRecvFileListRow *row); 15 | 16 | bool ftc_detail_recv_file_list_row_get_check_active(FtcDetailRecvFileListRow *row); 17 | 18 | void ftc_detail_recv_file_list_row_set_check_active(FtcDetailRecvFileListRow *row, bool check); 19 | 20 | void ftc_detail_recv_file_list_row_set_visible_progress(FtcDetailRecvFileListRow *row, bool is_visible); 21 | 22 | void ftc_detail_recv_file_list_row_set_progress(FtcDetailRecvFileListRow *row, int progress); 23 | 24 | #endif /* _FTC_UI_DETAIL_RECV_FILE_LIST_ROW_H */ 25 | -------------------------------------------------------------------------------- /src/src/ui/ftcdetailrecvfilelistsubpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_DETAIL_RECV_FILE_LIST_SUB_PAGE_H_ 2 | #define _FTC_UI_DETAIL_RECV_FILE_LIST_SUB_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | 5 | 6 | 7 | 8 | #define FTC_DETAIL_RECV_FILE_LIST_SUB_PAGE_TYPE (ftc_detail_recv_file_list_sub_page_get_type ()) 9 | G_DECLARE_FINAL_TYPE (FtcDetailRecvFileListSubPage, ftc_detail_recv_file_list_sub_page, FTC, DETAIL_RECV_FILE_LIST_SUB_PAGE, GtkBox) 10 | 11 | 12 | FtcDetailRecvFileListSubPage* ftc_detail_recv_file_list_sub_page_new(); 13 | 14 | void ftc_detail_recv_file_list_sub_page_set_data(FtcDetailRecvFileListSubPage *page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request, RequestDownloadState *request_down_state); 15 | 16 | void ftc_detail_recv_file_list_sub_page_set_all_check_active(FtcDetailRecvFileListSubPage *page, bool check); 17 | 18 | GSList* ftc_detail_recv_file_list_sub_page_get_checked_file_uid(FtcDetailRecvFileListSubPage *page); 19 | 20 | GSList* ftc_detail_recv_file_list_sub_page_get_all_file_uid(FtcDetailRecvFileListSubPage *page); 21 | 22 | void ftc_detail_recv_file_list_sub_page_update_activation_view(FtcDetailRecvFileListSubPage *page); 23 | 24 | void ftc_detail_recv_file_list_sub_page_set_progress_value(FtcDetailRecvFileListSubPage *page, const char *request_info_file_list_uid, int progress); 25 | 26 | #endif /* _FTC_UI_DETAIL_RECV_FILE_LIST_SUB_PAGE_H_ */ 27 | -------------------------------------------------------------------------------- /src/src/ui/ftcdetailrecvpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_DETAIL_RECV_PAGE_H_ 2 | #define _FTC_UI_DETAIL_RECV_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomerecvlistsubpage.h" 5 | 6 | 7 | 8 | 9 | #define FTC_DETAIL_RECV_PAGE_TYPE (ftc_detail_recv_page_get_type ()) 10 | G_DECLARE_FINAL_TYPE (FtcDetailRecvPage, ftc_detail_recv_page, FTC, DETAIL_RECV_PAGE, GtkBox) 11 | 12 | 13 | FtcDetailRecvPage* ftc_detail_recv_page_new(FtcHomeRecvListSubPage *recvlist_sub_page); 14 | 15 | void ftc_detail_recv_page_set_data(FtcDetailRecvPage *page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request, RequestDownloadState *request_down_state); 16 | 17 | bool ftc_detail_recv_page_file_download_all(FtcDetailRecvPage *page); 18 | 19 | 20 | #endif /* _FTC_UI_DETAIL_RECV_PAGE_H_ */ 21 | -------------------------------------------------------------------------------- /src/src/ui/ftcdetailrecvrequestinfosubpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_DETAIL_RECV_REQUEST_INFO_SUB_PAGE_H_ 2 | #define _FTC_UI_DETAIL_RECV_REQUEST_INFO_SUB_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | 5 | 6 | 7 | 8 | #define FTC_DETAIL_RECV_REQUEST_INFO_SUB_PAGE_TYPE (ftc_detail_recv_request_info_sub_page_get_type ()) 9 | G_DECLARE_FINAL_TYPE (FtcDetailRecvRequestInfoSubPage, ftc_detail_recv_request_info_sub_page, FTC, DETAIL_RECV_REQUEST_INFO_SUB_PAGE, GtkBox) 10 | 11 | 12 | FtcDetailRecvRequestInfoSubPage* ftc_detail_recv_request_info_sub_page_new(); 13 | 14 | void ftc_detail_recv_request_info_sub_page_set_data(FtcDetailRecvRequestInfoSubPage *page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request); 15 | 16 | #endif /* _FTC_UI_DETAIL_RECV_REQUEST_INFO_SUB_PAGE_H_ */ 17 | -------------------------------------------------------------------------------- /src/src/ui/ftcdetailsendhistoryfilelistrow.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_DETAIL_SEND_HISTORY_FILE_LIST_ROW_H 2 | #define _FTC_UI_DETAIL_SEND_HISTORY_FILE_LIST_ROW_H 3 | #include "ftcuicommon.h" 4 | 5 | 6 | #define FTC_DETAIL_SEND_HISTORY_FILE_LIST_ROW_TYPE (ftc_detail_send_history_file_list_row_get_type ()) 7 | G_DECLARE_FINAL_TYPE (FtcDetailSendHistoryFileListRow, ftc_detail_send_history_file_list_row, FTC, DETAIL_SEND_HISTORY_FILE_LIST_ROW, GtkBox) 8 | 9 | 10 | FtcDetailSendHistoryFileListRow* ftc_detail_send_history_file_list_row_new(); 11 | 12 | void ftc_detail_send_history_file_list_row_set_data(FtcDetailSendHistoryFileListRow *row, Ftc::Core::GlobalStruct::FtcRequestInfoFile &file_info, bool is_expired_date); 13 | 14 | const char* ftc_detail_send_history_file_list_row_get_file_uid(FtcDetailSendHistoryFileListRow *row); 15 | 16 | bool ftc_detail_send_history_file_list_row_get_check_active(FtcDetailSendHistoryFileListRow *row); 17 | 18 | void ftc_detail_send_history_file_list_row_set_check_active(FtcDetailSendHistoryFileListRow *row, bool check); 19 | 20 | void ftc_detail_send_history_file_list_row_set_visible_progress(FtcDetailSendHistoryFileListRow *row, bool is_visible); 21 | 22 | void ftc_detail_send_history_file_list_row_set_progress(FtcDetailSendHistoryFileListRow *row, int progress); 23 | 24 | #endif /* _FTC_UI_DETAIL_SEND_HISTORY_FILE_LIST_ROW_H */ 25 | -------------------------------------------------------------------------------- /src/src/ui/ftcdetailsendhistoryfilelistsubpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_DETAIL_SEND_HISTORY_FILE_LIST_SUB_PAGE_H_ 2 | #define _FTC_UI_DETAIL_SEND_HISTORY_FILE_LIST_SUB_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | 5 | 6 | 7 | 8 | #define FTC_DETAIL_SEND_HISTORY_FILE_LIST_SUB_PAGE_TYPE (ftc_detail_send_history_file_list_sub_page_get_type ()) 9 | G_DECLARE_FINAL_TYPE (FtcDetailSendHistoryFileListSubPage, ftc_detail_send_history_file_list_sub_page, FTC, DETAIL_SEND_HISTORY_FILE_LIST_SUB_PAGE, GtkBox) 10 | 11 | 12 | 13 | FtcDetailSendHistoryFileListSubPage* ftc_detail_send_history_file_list_sub_page_new(); 14 | 15 | void ftc_detail_send_history_file_list_sub_page_set_data(FtcDetailSendHistoryFileListSubPage *page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request, RequestDownloadState *request_down_state); 16 | 17 | void ftc_detail_send_history_file_list_sub_page_set_all_check_active(FtcDetailSendHistoryFileListSubPage *page, bool check); 18 | 19 | GSList* ftc_detail_send_history_file_list_sub_page_get_checked_file_uid(FtcDetailSendHistoryFileListSubPage *page); 20 | 21 | GSList* ftc_detail_send_history_file_list_sub_page_get_all_file_uid(FtcDetailSendHistoryFileListSubPage *page); 22 | 23 | void ftc_detail_send_history_file_list_sub_page_update_activation_view(FtcDetailSendHistoryFileListSubPage *page); 24 | 25 | void ftc_detail_send_history_file_list_sub_page_set_progress_value(FtcDetailSendHistoryFileListSubPage *page, const char *request_info_file_list_uid, int progress); 26 | 27 | #endif /* _FTC_UI_DETAIL_SEND_HISTORY_FILE_LIST_SUB_PAGE_H_ */ 28 | -------------------------------------------------------------------------------- /src/src/ui/ftcdetailsendhistorypage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_DETAIL_SEND_HISTORY_PAGE_H_ 2 | #define _FTC_UI_DETAIL_SEND_HISTORY_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomesendhistorysubpage.h" 5 | 6 | 7 | #define FTC_DETAIL_SEND_HISTORY_PAGE_TYPE (ftc_detail_send_history_page_get_type ()) 8 | G_DECLARE_FINAL_TYPE (FtcDetailSendHistoryPage, ftc_detail_send_history_page, FTC, DETAIL_SEND_HISTORY_PAGE, GtkBox) 9 | 10 | 11 | FtcDetailSendHistoryPage* ftc_detail_send_history_page_new(FtcHomeSendHistorySubPage *sendhistory_sub_page); 12 | 13 | void ftc_detail_send_history_page_set_data(FtcDetailSendHistoryPage *page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request, RequestDownloadState *request_down_state); 14 | 15 | GSList* ftc_detail_send_history_page_update_approval_info(FtcDetailSendHistoryPage *page); 16 | 17 | bool ftc_detail_send_history_page_file_download_all(FtcDetailSendHistoryPage *page); 18 | 19 | 20 | #endif /* _FTC_UI_DETAIL_SEND_HISTORY_PAGE_H_ */ 21 | -------------------------------------------------------------------------------- /src/src/ui/ftcdetailsendhistoryrequestinfosubpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_DETAIL_SEND_HISTORY_REQUEST_INFO_SUB_PAGE_H_ 2 | #define _FTC_UI_DETAIL_SEND_HISTORY_REQUEST_INFO_SUB_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftcdetailsendhistorypage.h" 5 | 6 | typedef struct _RequestInfo 7 | { 8 | Ftc::Core::GlobalStruct::FtcNetwork network; 9 | Ftc::Core::GlobalStruct::FtcRequestApprovalInfo approval; 10 | std::string download_expire_dt; 11 | GtkWidget *widget_target_network; 12 | GtkWidget *event_box; 13 | } RequestInfo; 14 | 15 | #define FTC_DETAIL_SEND_HISTORY_REQUEST_INFO_SUB_PAGE_TYPE (ftc_detail_send_history_request_info_sub_page_get_type ()) 16 | G_DECLARE_FINAL_TYPE (FtcDetailSendHistoryRequestInfoSubPage, ftc_detail_send_history_request_info_sub_page, FTC, DETAIL_SEND_HISTORY_REQUEST_INFO_SUB_PAGE, GtkBox) 17 | 18 | 19 | FtcDetailSendHistoryRequestInfoSubPage* ftc_detail_send_history_request_info_sub_page_new(FtcDetailSendHistoryPage *page); 20 | 21 | void ftc_detail_send_history_request_info_sub_page_set_data(FtcDetailSendHistoryRequestInfoSubPage *page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request, GSList *request_info_list); 22 | 23 | #endif /* _FTC_UI_DETAIL_RECV_REQUEST_INFO_SUB_PAGE_H_ */ 24 | -------------------------------------------------------------------------------- /src/src/ui/ftcdetailsendpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_DETAIL_SEND_PAGE_H_ 2 | #define _FTC_UI_DETAIL_SEND_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomesendlistsubpage.h" 5 | #include "../core/model/UploadOption.h" 6 | #include "../core/model/PackFilePop.h" 7 | 8 | 9 | 10 | #define FTC_DETAIL_SEND_PAGE_TYPE (ftc_detail_send_page_get_type ()) 11 | G_DECLARE_FINAL_TYPE (FtcDetailSendPage, ftc_detail_send_page, FTC, DETAIL_SEND_PAGE, GtkBox) 12 | 13 | 14 | FtcDetailSendPage* ftc_detail_send_page_new(FtcHomeSendListSubPage *sendlist_sub_page); 15 | 16 | void ftc_detail_send_page_disable(FtcDetailSendPage *page); 17 | 18 | void ftc_detail_send_page_enable(FtcDetailSendPage *page, Ftc::Core::PackFilePop *pack_file_pop); 19 | 20 | Ftc::Core::UploadOption* ftc_detail_send_page_get_upload_option(FtcDetailSendPage *page); 21 | 22 | bool ftc_detail_send_page_is_approval_update(FtcDetailSendPage *page); 23 | 24 | #endif /* _FTC_UI_DETAIL_SEND_PAGE_H_ */ 25 | -------------------------------------------------------------------------------- /src/src/ui/ftchomedndsubpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_DND_SUB_PAGE_H_ 2 | #define _FTC_UI_HOME_DND_SUB_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomepage.h" 5 | 6 | 7 | #define FTC_HOME_DND_SUB_PAGE_TYPE (ftc_home_dnd_sub_page_get_type ()) 8 | G_DECLARE_FINAL_TYPE (FtcHomeDndSubPage, ftc_home_dnd_sub_page, FTC, HOME_DND_SUB_PAGE, GtkBox) 9 | 10 | 11 | FtcHomeDndSubPage *ftc_home_dnd_sub_page_new(FtcHomePage *home_page); 12 | 13 | void ftc_home_dnd_sub_page_update_last_request(FtcHomeDndSubPage *page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request); 14 | 15 | void ftc_home_dnd_sub_page_set_new_recv_request_count(FtcHomeDndSubPage *page, int new_count); 16 | 17 | #endif /* _FTC_UI_HOME_DND_SUB_PAGE_H_ */ 18 | -------------------------------------------------------------------------------- /src/src/ui/ftchomeheaderrecvbox.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_HEADER_RECV_BOX_H_ 2 | #define _FTC_UI_HOME_HEADER_RECV_BOX_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomepage.h" 5 | 6 | 7 | #define FTC_HOME_HEADER_RECV_BOX_TYPE (ftc_home_header_recv_box_get_type ()) 8 | G_DECLARE_FINAL_TYPE (FtcHomeHeaderRecvBox, ftc_home_header_recv_box, FTC, HOME_HEADER_RECV_BOX, GtkBox) 9 | 10 | 11 | FtcHomeHeaderRecvBox* ftc_home_header_recv_box_new(FtcHomePage *home_page, const char *next_page_name); 12 | 13 | void ftc_home_header_recv_box_set_new_recv_request_count(FtcHomeHeaderRecvBox *box, int count); 14 | 15 | #endif /* _FTC_UI_HOME_HEADER_RECV_BOX_H_ */ 16 | -------------------------------------------------------------------------------- /src/src/ui/ftchomeheadersendbox.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_HEADER_SEND_BOX_H_ 2 | #define _FTC_UI_HOME_HEADER_SEND_BOX_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomepage.h" 5 | 6 | 7 | #define FTC_HOME_HEADER_SEND_BOX_TYPE (ftc_home_header_send_box_get_type ()) 8 | G_DECLARE_FINAL_TYPE (FtcHomeHeaderSendBox, ftc_home_header_send_box, FTC, HOME_HEADER_SEND_BOX, GtkBox) 9 | 10 | 11 | FtcHomeHeaderSendBox* ftc_home_header_send_box_new(FtcHomePage *home_page); 12 | 13 | 14 | 15 | 16 | #endif /* _FTC_UI_HOME_HEADER_SEND_BOX_H_ */ 17 | -------------------------------------------------------------------------------- /src/src/ui/ftchomeheadersendhistorybox.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_HEADER_SEND_HISTORY_BOX_H_ 2 | #define _FTC_UI_HOME_HEADER_SEND_HISTORY_BOX_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomepage.h" 5 | 6 | 7 | #define FTC_HOME_HEADER_SEND_HISTORY_BOX_TYPE (ftc_home_header_send_history_box_get_type ()) 8 | G_DECLARE_FINAL_TYPE (FtcHomeHeaderSendHistoryBox, ftc_home_header_send_history_box, FTC, HOME_HEADER_SEND_HISTORY_BOX, GtkBox) 9 | 10 | 11 | FtcHomeHeaderSendHistoryBox* ftc_home_header_send_history_box_new(FtcHomePage *home_page); 12 | 13 | void ftc_home_header_send_history_set_new_count(FtcHomeHeaderSendHistoryBox *box, int new_count); 14 | 15 | #endif /* _FTC_UI_HOME_HEADER_SEND_HISTORY_BOX_H_ */ 16 | -------------------------------------------------------------------------------- /src/src/ui/ftchomepage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_PAGE_H_ 2 | #define _FTC_UI_HOME_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | 5 | 6 | 7 | 8 | 9 | #define FTC_HOME_PAGE_TYPE (ftc_home_page_get_type ()) 10 | G_DECLARE_FINAL_TYPE (FtcHomePage, ftc_home_page, FTC, HOME_PAGE, GtkBox) 11 | 12 | 13 | FtcHomePage* ftc_home_page_new(); 14 | 15 | const char* ftc_home_page_get_current_page(FtcHomePage *page); 16 | 17 | void ftc_home_page_recv_list_refresh(FtcHomePage *page); 18 | 19 | 20 | #endif /* _FTC_UI_HOME_PAGE_H_ */ 21 | -------------------------------------------------------------------------------- /src/src/ui/ftchomerecvlistrow.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_RECV_LIST_ROW_H_ 2 | #define _FTC_UI_HOME_RECV_LIST_ROW_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomerecvlistsubpage.h" 5 | 6 | #define FTC_HOME_RECV_LIST_ROW_TYPE (ftc_home_recv_list_row_get_type ()) 7 | G_DECLARE_FINAL_TYPE (FtcHomeRecvListRow, ftc_home_recv_list_row, FTC, HOME_RECV_LIST_ROW, GtkBox) 8 | 9 | 10 | FtcHomeRecvListRow* ftc_home_recv_list_row_new(FtcHomeRecvListSubPage *recvlist_sub_page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request); 11 | 12 | Ftc::Core::GlobalStruct::FtcRequest* ftc_home_recv_list_row_get_ftc_request(FtcHomeRecvListRow *row); 13 | 14 | RequestDownloadState* ftc_home_recv_list_row_get_request_download_state(FtcHomeRecvListRow *row); 15 | 16 | void ftc_home_recv_list_row_update_title_read(FtcHomeRecvListRow *row); 17 | 18 | void ftc_home_recv_list_row_set_visible_progress(FtcHomeRecvListRow *row, bool is_visible); 19 | 20 | void ftc_home_recv_list_row_set_count_progress(FtcHomeRecvListRow *row, int count, int total_count); 21 | 22 | void ftc_home_recv_list_row_add_count_progress(FtcHomeRecvListRow *row); 23 | 24 | void ftc_home_recv_list_row_set_progress_background_value(FtcHomeRecvListRow *row, const char *request_info_file_list_uid, int progress); 25 | 26 | void ftc_home_recv_list_row_download_complete(FtcHomeRecvListRow *row); 27 | 28 | #endif /* _FTC_UI_HOME_RECV_LIST_ROW_H_ */ 29 | -------------------------------------------------------------------------------- /src/src/ui/ftchomerecvlistsubpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_RECV_LIST_SUB_PAGE_H_ 2 | #define _FTC_UI_HOME_RECV_LIST_SUB_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomepage.h" 5 | 6 | #define FTC_HOME_RECV_LIST_SUB_PAGE_TYPE (ftc_home_recv_list_sub_page_get_type ()) 7 | G_DECLARE_FINAL_TYPE (FtcHomeRecvListSubPage, ftc_home_recv_list_sub_page, FTC, HOME_RECV_LIST_SUB_PAGE, GtkBox) 8 | 9 | 10 | 11 | FtcHomeRecvListSubPage* ftc_home_recv_list_sub_page_new(FtcHomePage *home_page); 12 | 13 | void ftc_home_recv_list_sub_page_get_receive_list(FtcHomeRecvListSubPage *page); 14 | 15 | int ftc_home_recv_list_sub_page_get_recv_request_new_count(FtcHomeRecvListSubPage *page); 16 | 17 | void ftc_home_recv_list_sub_page_list_box_select_row_and_batch_download(FtcHomeRecvListSubPage *page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request); 18 | 19 | void ftc_home_recv_list_sub_page_list_box_unselect_all(FtcHomeRecvListSubPage *page); 20 | 21 | void ftc_home_recv_list_sub_page_set_visible_progress(FtcHomeRecvListSubPage *page, const char *request_info_uid, bool is_visible, int total_count); 22 | 23 | void ftc_home_recv_list_sub_page_set_progress_background_value(FtcHomeRecvListSubPage *page, const char *request_info_uid, const char *request_info_file_list_uid, int progress); 24 | 25 | void ftc_home_recv_list_sub_page_update_total_progress(FtcHomeRecvListSubPage *page, const char *request_info_uid); 26 | 27 | void ftc_home_recv_list_sub_page_download_complete(FtcHomeRecvListSubPage *page, const char *request_info_uid); 28 | 29 | 30 | #endif /* _FTC_UI_HOME_RECV_LIST_SUB_PAGE_H_ */ 31 | -------------------------------------------------------------------------------- /src/src/ui/ftchomesendhistoryrow.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_SEND_HISTORY_ROW_H_ 2 | #define _FTC_UI_HOME_SEND_HISTORY_ROW_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomesendhistorysubpage.h" 5 | 6 | #define FTC_HOME_SEND_HISTORY_ROW_TYPE (ftc_home_send_history_row_get_type ()) 7 | G_DECLARE_FINAL_TYPE (FtcHomeSendHistoryRow, ftc_home_send_history_row, FTC, HOME_SEND_HISTORY_ROW, GtkBox) 8 | 9 | 10 | FtcHomeSendHistoryRow* ftc_home_send_history_row_new(FtcHomeSendHistorySubPage *sendhistory_sub_page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request); 11 | 12 | Ftc::Core::GlobalStruct::FtcRequest* ftc_home_send_history_row_get_ftc_request(FtcHomeSendHistoryRow *row); 13 | 14 | RequestDownloadState* ftc_home_send_history_row_get_request_download_state(FtcHomeSendHistoryRow *row); 15 | 16 | void ftc_home_send_history_row_update_title_read(FtcHomeSendHistoryRow *row); 17 | 18 | void ftc_home_send_history_row_set_visible_progress(FtcHomeSendHistoryRow *row, bool is_visible); 19 | 20 | void ftc_home_send_history_row_set_count_progress(FtcHomeSendHistoryRow *row, int count, int total_count); 21 | 22 | void ftc_home_send_history_row_add_count_progress(FtcHomeSendHistoryRow *row); 23 | 24 | void ftc_home_send_history_row_set_progress_background_value(FtcHomeSendHistoryRow *row, const char *request_info_file_list_uid, int progress); 25 | 26 | void ftc_home_send_history_row_download_complete(FtcHomeSendHistoryRow *row); 27 | 28 | #endif /* _FTC_UI_HOME_SEND_HISTORY_ROW_H_ */ 29 | -------------------------------------------------------------------------------- /src/src/ui/ftchomesendhistorysubpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_SEND_HISTORY_SUB_PAGE_H_ 2 | #define _FTC_UI_HOME_SEND_HISTORY_SUB_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomepage.h" 5 | 6 | #define FTC_HOME_SEND_HISTORY_SUB_PAGE_TYPE (ftc_home_send_history_sub_page_get_type ()) 7 | G_DECLARE_FINAL_TYPE (FtcHomeSendHistorySubPage, ftc_home_send_history_sub_page, FTC, HOME_SEND_HISTORY_SUB_PAGE, GtkBox) 8 | 9 | 10 | 11 | FtcHomeSendHistorySubPage* ftc_home_send_history_sub_page_new(FtcHomePage *home_page); 12 | 13 | void ftc_home_send_history_sub_page_get_send_history_list(FtcHomeSendHistorySubPage *page); 14 | 15 | void ftc_home_send_history_sub_page_list_box_select_row_and_batch_download(FtcHomeSendHistorySubPage *page, Ftc::Core::GlobalStruct::FtcRequest *ftc_request); 16 | 17 | void ftc_home_send_history_sub_page_list_box_unselect_all(FtcHomeSendHistorySubPage *page); 18 | 19 | void ftc_home_send_history_sub_page_set_visible_progress(FtcHomeSendHistorySubPage *page, const char *request_info_uid, bool is_visible, int total_count); 20 | 21 | void ftc_home_send_history_sub_page_set_progress_background_value(FtcHomeSendHistorySubPage *page, const char *request_info_uid, const char *request_info_file_list_uid, int progress); 22 | 23 | void ftc_home_send_history_sub_page_update_total_progress(FtcHomeSendHistorySubPage *page, const char *request_info_uid); 24 | 25 | void ftc_home_send_history_sub_page_download_complete(FtcHomeSendHistorySubPage *page, const char *request_info_uid); 26 | 27 | 28 | #endif /* _FTC_UI_HOME_SEND_HISTORY_SUB_PAGE_H_ */ 29 | -------------------------------------------------------------------------------- /src/src/ui/ftchomesendlistrow.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_SEND_LIST_ROW_H_ 2 | #define _FTC_UI_HOME_SEND_LIST_ROW_H_ 3 | #include "ftcuicommon.h" 4 | 5 | 6 | #define FTC_HOME_SEND_LIST_ROW_TYPE (ftc_home_send_list_row_get_type ()) 7 | G_DECLARE_FINAL_TYPE (FtcHomeSendListRow, ftc_home_send_list_row, FTC, HOME_SEND_LIST_ROW, GtkBox) 8 | 9 | 10 | FtcHomeSendListRow* ftc_home_send_list_row_new(Ftc::Core::FileInfo &fi); 11 | 12 | const char* ftc_home_send_list_row_get_file_name(FtcHomeSendListRow *row); 13 | 14 | const char* ftc_home_send_list_row_get_file_path(FtcHomeSendListRow *row); 15 | 16 | const char* ftc_home_send_list_row_get_relative_dir(FtcHomeSendListRow *row); 17 | 18 | long long ftc_home_send_list_row_get_file_size(FtcHomeSendListRow *row); 19 | 20 | void ftc_home_send_list_row_set_upload_status(FtcHomeSendListRow *row, Ftc::Core::Transfer::UploadStatus status); 21 | 22 | Ftc::Core::Transfer::UploadStatus ftc_home_send_list_row_get_upload_status(FtcHomeSendListRow *row); 23 | 24 | void ftc_home_send_list_row_set_progress(FtcHomeSendListRow *row, int progress); 25 | 26 | void ftc_home_send_list_row_set_visible_progressbar(FtcHomeSendListRow *row, bool is_visible); 27 | 28 | #endif /* _FTC_UI_HOME_SEND_LIST_ROW_H_ */ 29 | -------------------------------------------------------------------------------- /src/src/ui/ftchomesendlistsubpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_HOME_SEND_LIST_SUB_PAGE_H_ 2 | #define _FTC_UI_HOME_SEND_LIST_SUB_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftchomepage.h" 5 | 6 | 7 | 8 | 9 | #define FTC_HOME_SEND_LIST_SUB_PAGE_TYPE (ftc_home_send_list_sub_page_get_type ()) 10 | G_DECLARE_FINAL_TYPE (FtcHomeSendListSubPage, ftc_home_send_list_sub_page, FTC, HOME_SEND_LIST_SUB_PAGE, GtkBox) 11 | 12 | 13 | FtcHomeSendListSubPage* ftc_home_send_list_sub_page_new(FtcHomePage *home_page); 14 | 15 | bool ftc_home_send_list_sub_page_enable(FtcHomeSendListSubPage *page); 16 | 17 | void ftc_home_send_list_sub_page_disable(FtcHomeSendListSubPage *page); 18 | 19 | void ftc_home_send_list_sub_page_add_list(FtcHomeSendListSubPage *page, const char *path); 20 | 21 | void ftc_home_send_list_sub_page_add_list_file_info(FtcHomeSendListSubPage *page, Ftc::Core::FileInfo &fi); 22 | 23 | int ftc_home_send_list_sub_page_list_box_get_size(FtcHomeSendListSubPage *page); 24 | 25 | void ftc_home_send_list_sub_page_activate_extension_window(FtcHomeSendListSubPage *page, bool only_extension); 26 | 27 | bool ftc_home_send_list_sub_page_is_uploading(FtcHomeSendListSubPage *page); 28 | 29 | 30 | 31 | 32 | #endif /* _FTC_UI_HOME_SEND_LIST_SUB_PAGE_H_ */ 33 | -------------------------------------------------------------------------------- /src/src/ui/ftcloginpage.h: -------------------------------------------------------------------------------- 1 | #ifndef _FTC_UI_LOGIN_PAGE_H_ 2 | #define _FTC_UI_LOGIN_PAGE_H_ 3 | #include "ftcuicommon.h" 4 | #include "ftcmainwindow.h" 5 | 6 | 7 | #define FTC_LOGIN_PAGE_TYPE (ftc_login_page_get_type ()) 8 | G_DECLARE_FINAL_TYPE (FtcLoginPage, ftc_login_page, FTC, LOGIN_PAGE, GtkBox) 9 | 10 | 11 | FtcLoginPage *ftc_login_page_new(); 12 | 13 | void ftc_login_page_do_login(FtcLoginPage *page); 14 | 15 | void ftc_login_page_set_login_state(FtcLoginPage *page, bool state); 16 | 17 | bool ftc_login_page_get_login_state(FtcLoginPage *page); 18 | 19 | 20 | #endif /* _FTC_UI_LOGIN_PAGE_H_ */ 21 | -------------------------------------------------------------------------------- /src/src/ui/ftcmainwindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | 13 | #ifndef _FTC_UI_MAIN_WINDOW_H_ 14 | #define _FTC_UI_MAIN_WINDOW_H_ 15 | #include "ftcuicommon.h" 16 | #include "ftcapplication.h" 17 | 18 | #define FTC_TYPE_MAIN_WINDOW (ftc_main_window_get_type ()) 19 | G_DECLARE_FINAL_TYPE (FtcMainWindow, ftc_main_window, FTC, MAIN_WINDOW, GtkApplicationWindow) 20 | 21 | 22 | 23 | FtcMainWindow *ftc_main_window_new (FtcApplication *app); 24 | void ftc_main_window_open (FtcMainWindow *main_window, 25 | GFile *file); 26 | 27 | void ftc_main_window_set_detail_send_page(FtcMainWindow *main_window, gpointer page); 28 | void ftc_main_window_set_detail_recv_page(FtcMainWindow *main_window, gpointer page); 29 | void ftc_main_window_set_detail_send_history_page(FtcMainWindow *main_window, gpointer page); 30 | gpointer ftc_main_window_get_detail_send_page(FtcMainWindow *main_window); 31 | gpointer ftc_main_window_get_detail_recv_page(FtcMainWindow *main_window); 32 | gpointer ftc_main_window_get_detail_send_history_page(FtcMainWindow *main_window); 33 | 34 | 35 | #endif /* _FTC_UI_MAIN_WINDOW_H_ */ 36 | -------------------------------------------------------------------------------- /src/src/webkit/ftcdbusserver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include "../core/core.h" 13 | #include "../dbus/ftcappdbus.h" 14 | #include "ftcdbusserver.h" 15 | #include "ftcwebkit.h" 16 | 17 | static OrgHunesionAppPlayback *s_play_back = NULL; 18 | static guint s_mBusId = -1; 19 | 20 | static gboolean on_handle_invoke_client_action_callback(OrgHunesionAppPlayback *interface, 21 | GDBusMethodInvocation *invocation, 22 | guint seq , 23 | const gchar *json, 24 | gpointer user_data) 25 | { 26 | gboolean rv = FALSE; 27 | FTC_LOG_DEBUG("------------------------> handle_invoke_client_action_callback seq : %d, Msg %s PID = (%d)", seq , json, getPID()); 28 | FTC_LOG_DEBUG("------------------------> IS MAIN THREAD (%s)", ftc_is_main_thread() ? "TRUE" : "FALSE"); 29 | ftc_web_kit_dialog_hide(seq, json); 30 | org_hunesion_app_playback_complete_invoke_client_action_callback(interface, invocation); 31 | rv = TRUE; 32 | return rv; 33 | } 34 | 35 | static void on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data) 36 | { 37 | GError *error = NULL; 38 | FTC_LOG_DEBUG("on_bus_acquired = %s", name); 39 | s_play_back = org_hunesion_app_playback_skeleton_new(); 40 | if (!s_play_back) 41 | { 42 | FTC_LOG("org_hunesion_app_playback_skeleton_new failed"); 43 | return; 44 | } 45 | 46 | g_signal_connect(s_play_back, "handle-invoke-client-action-callback", G_CALLBACK(on_handle_invoke_client_action_callback), NULL); 47 | if (!g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(s_play_back), connection, FTC_APP_BUS_OBJ_NAME, &error)) 48 | { 49 | FTC_LOG("g_dbus_interface_skeleton_export failed"); 50 | g_object_unref(s_play_back); 51 | s_play_back = NULL; 52 | } 53 | 54 | if (error) { 55 | g_error_free(error); 56 | } 57 | 58 | } 59 | 60 | static void on_name_acquired(GDBusConnection *connection, 61 | const gchar *name, 62 | gpointer user_data) 63 | { 64 | 65 | FTC_LOG("on_name_acquired = %s", name); 66 | } 67 | 68 | static void on_name_lost(GDBusConnection *connection, 69 | const gchar *name, 70 | gpointer user_data) 71 | { 72 | FTC_LOG("on_name_lost = %s", name); 73 | } 74 | 75 | bool ftc_dbus_server_init() 76 | { 77 | bool rv = false; 78 | s_mBusId = g_bus_own_name(G_BUS_TYPE_SESSION, FTC_APP_BUS_NAME, 79 | (GBusNameOwnerFlags)(G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | G_BUS_NAME_OWNER_FLAGS_REPLACE), 80 | on_bus_acquired, 81 | on_name_acquired, 82 | on_name_lost, 83 | NULL, 84 | NULL); 85 | 86 | if (s_mBusId <= 0){ 87 | FTC_LOG("g_bus_own_name failed (name : %s)", FTC_APP_BUS_NAME); 88 | return rv; 89 | } 90 | 91 | FTC_LOG_DEBUG("ftc_dbus_server_init successful"); 92 | rv = true; 93 | return rv; 94 | } 95 | 96 | bool ftc_dbus_server_destory() 97 | { 98 | bool rv = false; 99 | 100 | if (s_play_back) 101 | { 102 | g_dbus_interface_skeleton_unexport(G_DBUS_INTERFACE_SKELETON(s_play_back)); 103 | s_play_back = NULL; 104 | } 105 | 106 | if (s_mBusId <= 0) 107 | return rv; 108 | 109 | g_bus_unown_name(s_mBusId); 110 | s_mBusId = 0; 111 | FTC_LOG_DEBUG("ftc_dbus_server_destory successful"); 112 | rv = true; 113 | return rv; 114 | } -------------------------------------------------------------------------------- /src/src/webkit/ftcdbusserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_DBUS_SERVER_H_ 13 | #define _FTC_DBUS_SERVER_H_ 14 | 15 | bool ftc_dbus_server_init(); 16 | bool ftc_dbus_server_destory(); 17 | 18 | #endif -------------------------------------------------------------------------------- /src/src/webkit/ftcwebkit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_WEB_KIT_H_ 13 | #define _FTC_WEB_KIT_H_ 14 | #include 15 | #include 16 | #include "../core/core.h" 17 | 18 | 19 | enum JavascriptRunPoint 20 | { 21 | Started = 0, 22 | Finished 23 | }; 24 | 25 | 26 | typedef struct _WebViewResultParam 27 | { 28 | gpointer user_data; 29 | JsonNode *node; 30 | 31 | _WebViewResultParam() { 32 | user_data = NULL; 33 | node = NULL; 34 | } 35 | } WebViewResultParam; 36 | 37 | void ftc_web_kit_add_javascript_action(const char *url, const char *script, JavascriptRunPoint javascript_run_point); 38 | bool ftc_web_kit_show_modal_dialog(GtkWindow *parent, const char *url, HTTP_PARAM *param, const char *title, int width, int height, const char *event_name = NULL, gpointer user_data = NULL, bool modal = true, bool hide = false, bool debug = true); 39 | bool ftc_web_kit_show_dialog_post(GtkWindow *parent, const char *url, HTTP_PARAM *param, const char *title, int width, int height, const char *event_name = NULL, gpointer user_data = NULL, bool modal = true, bool hide = false, bool debug = true); 40 | bool ftc_web_kit_dialog_hide(int seq , const gchar *json); 41 | bool ftc_web_dialog_remove_all(); 42 | #endif -------------------------------------------------------------------------------- /src/src/webkitextension/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.8) 2 | 3 | 4 | set (CMAKE_POSITION_INDEPENDENT_CODE ON) 5 | add_library(ftcwebextension MODULE 6 | ftcwebkitextension.cpp 7 | ../dbus/playback.c 8 | ) 9 | TARGET_LINK_LIBRARIES(ftcwebextension ${WEBKIT_EXT_LIBRARIES} json-glib-1.0 -fPIC) -------------------------------------------------------------------------------- /src/src/webkitextension/ftcwebkitextension.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #include 13 | #include 14 | #include "ftcwebkitextension.h" 15 | #include "../dbus/ftcappdbus.h" 16 | 17 | #include 18 | #include 19 | 20 | G_BEGIN_DECLS 21 | 22 | 23 | static guint32 s_web_view_seq = 0 ; 24 | 25 | static void invokeClientActionCallback(const char* message) 26 | { 27 | 28 | OrgHunesionAppPlayback *proxy = NULL ; 29 | GError *error = NULL ; 30 | #ifdef FTC_DEBUG 31 | printf("---------------------> invokeClientActionCallback PID = %d\n", getpid()); 32 | #endif 33 | proxy = org_hunesion_app_playback_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, FTC_APP_BUS_NAME, FTC_APP_BUS_OBJ_NAME, NULL , &error); 34 | 35 | if (!proxy) return ; 36 | 37 | org_hunesion_app_playback_call_invoke_client_action_callback_sync(proxy , s_web_view_seq, message, NULL, &error); 38 | 39 | if (proxy){ 40 | g_object_unref(proxy); 41 | } 42 | 43 | if (error) { 44 | g_error_free(error); 45 | error = NULL; 46 | } 47 | } 48 | 49 | static void window_object_cleared_callback(WebKitScriptWorld *world, WebKitWebPage *web_page, WebKitFrame *frame , gpointer user_data){ 50 | JSCContext *context = webkit_frame_get_js_context_for_script_world(frame, world); 51 | JSCValue *function = jsc_value_new_function(context, "invokeClientAction", G_CALLBACK(invokeClientActionCallback), NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING); 52 | 53 | jsc_context_set_value(context , "invokeClientAction", function) ; 54 | #ifdef FTC_DEBUG 55 | g_print("-------------------> window_object_cleared_callback\n"); 56 | #endif 57 | } 58 | 59 | static gboolean web_page_send_request(WebKitWebPage *web_page, WebKitURIRequest *request , WebKitURIResponse *redirect_response, gpointer user_data){ 60 | const char *request_uri = NULL; 61 | const char *page_uri = NULL ; 62 | 63 | request_uri = webkit_uri_request_get_uri(request); 64 | page_uri = webkit_web_page_get_uri(web_page); 65 | #ifdef FTC_DEBUG 66 | g_print("------------------->Send Request RequestURI = %s PageURI = %s\n", request_uri, page_uri); 67 | #endif 68 | return FALSE ; 69 | } 70 | 71 | static void 72 | web_page_created_callback(WebKitWebExtension *extension, WebKitWebPage *web_page, gpointer user_data){ 73 | #ifdef FTC_DEBUG 74 | g_print("------------------->Page %ld created for %s\n", webkit_web_page_get_id(web_page), webkit_web_page_get_uri(web_page)); 75 | #endif 76 | } 77 | 78 | 79 | G_MODULE_EXPORT void 80 | webkit_web_extension_initialize_with_user_data(WebKitWebExtension *extension, GVariant *user_data){ 81 | #ifdef FTC_DEBUG 82 | g_print("-------------------> webkit_web_extension_initialize\n"); 83 | #endif 84 | if (user_data && g_variant_is_of_type(user_data, G_VARIANT_TYPE_UINT32)){ 85 | s_web_view_seq = g_variant_get_uint32(user_data); 86 | } 87 | g_signal_connect(extension, "page-created", G_CALLBACK(web_page_created_callback), NULL); 88 | g_signal_connect(webkit_script_world_get_default(), "window-object-cleared", G_CALLBACK(window_object_cleared_callback), NULL) ; 89 | } 90 | 91 | G_END_DECLS -------------------------------------------------------------------------------- /src/src/webkitextension/ftcwebkitextension.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 Hunesion Inc. 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; 7 | * either version 2.1 of the License, or (at your option) any later version. 8 | * See the file COPYING included with this distribution for more information. 9 | * https://github.com/HuneOpenUp/ossFileTransferClient/blob/master/COPYING 10 | */ 11 | 12 | #ifndef _FTC_WEB_KIT_EXTENSION_H_ 13 | #define _FTC_WEB_KIT_EXTENSION_H_ 14 | 15 | 16 | #endif --------------------------------------------------------------------------------